411f9f98c01e
Copy a Flows based on the specified Flow Ids
You need workspaces.flow.edit permission and belong to workspace containing source flow to access this resource Flows can be copied only to another workspace, if you copy many flows at once you can not copy them in to existing flows
Flow is copied into draft of new/existing flow. So to make flow to work draft should be published manually. That is done to avoid disruptions of already running flow (flow is not stopped or changed in any other way except draft), and because most likely flow copy will require additional configuration. Flow can be copied in any workspace and contract, of course if user has enough privileges to read original flow and has enough privileges to edit flow in destination workspace. Platform forbids to copy flow if flow components can not be used in destination context (e.g. component visibility is restricted to team, and you are copying flow in another contract)
Notices:
- The topic (data.attributes[topic_id]) must be accessible to the flow in the destination workspace, otherwise it will not be copied.
- It's forbidden to use the data.attributes[topic_id] parameter if flow does not contain at least one step with Pub/Sub component.
- It's forbidden to use the data.attributes[topic_id] parameter if your flow uses more than one Pub/Sub topic in different steps. You can copy the flow if your flow has several Pub/Sub steps that uses only one topic.
- In case when the data.attributes[topic_id] parameter is absent from your call, topics ID will be removed from a copy if it's not accessible and left intact if the topic is available in destination context.
- In case if one of the flows has more then one topic but only one was provided, has no topics and one was provided, some components are hidden from destination workspace, or quota was exuded the flow will be put to errored array along with the reason of rejection
Please note the following facts about credentials, secrets, topics and agents used in flow:
- All these entities are not copied along with the flow if they are not accessible in the destination context.
- Naturally, if the flow is copied into the same workspace, these entities will be accessible to the flow draft.
- Topic can be replaced during copy. Read details about data.attributes.topic_id parameter.
Request body
Example request
{
"data": {
"attributes": [
{
"name": "My new Flow",
"flow_id": "5b4f337bff4304610483ba67",
"topic_id": "5b4f337bff4304610483ba67"
}
],
"relationships": {
"dest_workspace": {
"data": {
"id": "5b4f337bff4304610483ba67"
}
}
}
}
}Response
Created
Example response
{
"data": {
"coped": [
{
"id": "5b4f337bff4304610483ba67",
"links": {
"self": "/v2/flows/5b4f337bff4304610483ba67"
},
"attributes": {
"created_at": "2020-01-12T14:50:42.215Z",
"last_modified": "2021-12-13T14:24:53.825Z",
"name": "PetStore to Email Flow",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"cron": "*/3 * * * *",
"shut_down_timeout": 5,
"graph": {
"nodes": [
{
"name": "petStore",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"command": "core/petStore:getPetsByStatus@51ff8236dd1d461f67111b145f69441bafdeb710",
"id": "step_1",
"credentials_id": "609e6f5164b6470011d26387",
"selected_data_samples": [
"5b4f337bff4304610483ba67"
]
}
],
"edges": [
{
"id": "mapper:step_1:step_2",
"target": "step_2",
"source": "step_1",
"config": {
"mapper_type": "jsonata"
}
}
]
},
"api_version": "2.0",
"stats_enabled": true,
"updated_at": "2021-12-13T14:24:53.825Z"
},
"relationships": {
"user": {
"data": {
"id": "5b4f337bff4304610483ba67"
},
"links": {
"self": "/v2/users/5b4f337bff4304610483ba67"
}
},
"workspace": {
"data": {
"id": "5b4f337bff4304610483ba67"
},
"links": {
"self": "/v2/workspaces/5b4f337bff4304610483ba67"
}
},
"versions": {
"links": {
"related": "/v2/flows/5b4f337bff4304610483ba67/versions"
}
},
"latest_version": {
"data": {
"id": "e4b690fb0a65c37789e7be0bf523414e0f98a8e6"
},
"links": {
"self": "/v2/flows/5b4f337bff4304610483ba67/versions/e4b690fb0a65c37789e7be0bf523414e0f98a8e6",
"related": "/v2/flows/5b4f337bff4304610483ba67/versions/e4b690fb0a65c37789e7be0bf523414e0f98a8e6"
}
}
}
}
],
"errored": [
{
"id": "65785b02300aaa1a2923bf35",
"error": {
"message": "The request can not be processed because the quota exceeded"
}
}
]
}
}