Craft Function

Update Craft Function

Craft function更新のリクエストを送信します。

Required Scope

APIの実行に必要なScopeです。

beta.craft.function.update

Required Role

管理画面でScopeを追加する際に必要な権限です。

Craft > Craft 設定の編集
post/v2beta/craft/function/update

Request

  • Base URL
    https://api.karte.io
  • URL
    https://api.karte.io/v2beta/craft/function/update
  • Auth
    HTTP bearer

Headers

x-karte-apistring

今後利用する可能性のある予約語です。現在は設定不要です。

authorizationstring

認証情報を含むトークンです。"Authorization" ヘッダーに Bearer <token> の形式で設定してください。

content-typestring

リクエストのコンテンツタイプを指定します。通常は application/json を使用してください。

Request body

idstring required

ファンクションIDです。管理画面のURLに含まれるIDです。

descriptionstring required

ファンクションの説明

codestring required

ファンクションのJavascriptコード

packagesobject required

ファンクションのモジュール

activeboolean

ファンクションの有効・無効

kickHookV2boolean

この操作でHook V2のトリガーを発火するかどうか。(参照)

refreshDependenciesboolean

デプロイ時にパッケージ依存関係を更新するかどうか。モジュール(packages)に変更がある場合はこの値に関わらずパッケージ依存関係が自動的に再解決されます。

minReleaseAgenumber

パッケージ最小公開日数(日数)。デフォルトは5日。npm公開から指定日数未満のパッケージバージョンをインストール対象から除外します。最近公開されたバージョンを使用する場合は0を指定してください。

skipRecreateIfFailedboolean

FAILED状態のHTTPファンクションを更新する際、ファンクションを再作成せずに更新するかどうか。 trueの場合、既存のファンクションを削除せずに更新を試みます。HTTPファンクション以外では指定できません。 未指定またはfalseの場合、FAILED時は従来どおり再作成します。 詳細: https://craft.developers.karte.io/craft-functions/edit-craft-funcitons/#デプロイに失敗した場合

Example request

{
  "id": "1234567890abcdef12345678",
  "description": "This is a sample description for the craft service function.",
  "code": "export default async function (data) { return true; }",
  "variables": [
    {
      "name": "LOG_LEVEL",
      "description": "Log level",
      "type": "string",
      "required": true
    }
  ],
  "packages": {
    "package1": "1.0.0",
    "package2": "2.0.0"
  },
  "active": true,
  "kickHookV2": true
}

Response

A successful response.

idstring required
namestring required
codeVersionstring required

現在のコードバージョン

activeboolean required

ファンクションの有効状態

descriptionstring nullable
createdstring required

ファンクションの作成日時

modifiedstring required

ファンクションの更新日時

status'SUCCESS' | 'IN_PROGRESS' | 'FAILED' required

ファンクションの最新のデプロイ結果

Changes

No recorded changes to this operation across all 1 revision of this API.