Functions

Copy a Function

Creates a copy of an existing function with a new name. The copied function will have all the same configuration, schema, and settings as the source function, but with a new name and optionally new display name and tags. The function can optionally be copied to a different environment within the same account.

POST
/v2/functions/copy
x-api-key<token>

Authenticate using API Key in request header

In: header

Request Body

application/json

sourceFunctionName*string

Name of the function to copy from. Must be a valid existing function name.

targetFunctionName*string

Name for the new copied function. Must be unique within the target environment.

targetDisplayName?string

Optional display name for the copied function. If not provided, defaults to the source function's display name with " (Copy)" appended.

targetEnvironment?string

Optional environment name to copy the function to. If not provided, the function will be copied within the same environment.

tags?array<>

Optional array of tags for the copied function. If not provided, defaults to the source function's tags.

Response Body

application/json

application/json

curl -X POST "https://api.bem.ai/v2/functions/copy" \  -H "Content-Type: application/json" \  -d '{    "sourceFunctionName": "invoice-processor",    "targetFunctionName": "invoice-processor-dev",    "targetEnvironment": "production",    "targetDisplayName": "Invoice Processor (Production)"  }'
{
  "functionID": "string",
  "functionName": "string",
  "versionNum": 0,
  "usedInWorkflows": [
    {
      "workflowID": "string",
      "workflowName": "string",
      "currentVersionNum": 0,
      "usedInWorkflowVersionNums": [
        0
      ]
    }
  ],
  "displayName": "string",
  "tags": [
    "string"
  ],
  "audit": {
    "functionCreatedBy": {
      "userActionID": "string",
      "userID": "string",
      "userEmail": "string",
      "apiKeyName": "string",
      "emailAddress": "string",
      "createdAt": "2019-08-24T14:15:22Z"
    },
    "functionLastUpdatedBy": {
      "userActionID": "string",
      "userID": "string",
      "userEmail": "string",
      "apiKeyName": "string",
      "emailAddress": "string",
      "createdAt": "2019-08-24T14:15:22Z"
    },
    "versionCreatedBy": {
      "userActionID": "string",
      "userID": "string",
      "userEmail": "string",
      "apiKeyName": "string",
      "emailAddress": "string",
      "createdAt": "2019-08-24T14:15:22Z"
    }
  },
  "type": "transform",
  "outputSchemaName": "string",
  "outputSchema": {},
  "emailAddress": "string",
  "tabularChunkingEnabled": true
}
{
  "message": "string",
  "code": 0,
  "details": {}
}