nodes_datalinks_batch_create
const url = 'https://example.com/api/nodes/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/datalinks/batch';const options = { method: 'POST', headers: { 'X-Workspace': '2489E9AD-2EE2-8E00-8EC9-32D5F69181C0', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"connection":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","data":[{"external_id":"example","name":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/nodes/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/datalinks/batch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'X-Workspace: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \ --data '{ "connection": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "data": [ { "external_id": "example", "name": "example" } ] }'Link several data of a connection to the node, in a single request.
The datalinks are created at once and returned with their data in progress: nothing is read from the source yet, so the answer does not
wait for it. The task identified by task_id then reads each data (its
attributes, the access right of the user, its metadata and associations)
and turns it active, or failed with an enrichment_error. Until
then a data can only be read and deleted.
A data already linked to the node is returned with created: false and
left untouched. A data already being enriched for another node is linked,
and left to the task enriching it. The answer is a 202 when a task was
queued; a 200 without a task otherwise.
The task can be read with GET /api/tasks/{task_id} as soon as this
request is answered: it is PENDING until a worker starts it. Once it
succeeded, its result holds the outcome of every datalink. The
datalinks that failed are also listed by
GET /api/nodes/{node_id}/datalinks?status=failed.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Workspace ID
Request Bodyrequired
Section titled “Request Bodyrequired”Serializer for a batch of data of a connection, given by their external ids.
object
Serializer for one data of a batch, given by its external id.
object
Name shown until the data is read from its source, which then replaces it. Defaults to the external id.
Example generated
{ "connection": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "data": [ { "external_id": "example", "name": "example" } ]}Serializer for a batch of data of a connection, given by their external ids.
object
Serializer for one data of a batch, given by its external id.
object
Name shown until the data is read from its source, which then replaces it. Defaults to the external id.
Example generated
connection=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0&data=%7B%22external_id%22%3A%22example%22%2C%22name%22%3A%22example%22%7DSerializer for a batch of data of a connection, given by their external ids.
object
Serializer for one data of a batch, given by its external id.
object
Name shown until the data is read from its source, which then replaces it. Defaults to the external id.
Responses
Section titled “Responses”Serializer for the answer to the creation of a batch of datalinks.
object
Task enriching the created datalinks, to follow with GET /api/tasks/{task_id}. Null when nothing is to be enriched.
Serializer for what became of one data of a batch.
object
False when the data was already linked to the node.
Serializer for Datalink.
object
Return serialized data object with request context.
Parameters
obj : DataLink The object containing the data that needs to be serialized.
Returns
DatalinkDataSerializer A DatalinkDataSerializer object is being returned, with the data attribute of the input obj and the context set to include the request from the current context.
object
Return the interactor information of the object’s creator.
Parameters
obj : DataLink The object containing the creator information.
Returns
dict The interactor information of the creator.
object
Example generated
{ "task_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "created": 1, "existing": 1, "results": [ { "external_id": "example", "created": true, "datalink": { "node": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "data": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } } ]}Serializer for the answer to the creation of a batch of datalinks.
object
Task enriching the created datalinks, to follow with GET /api/tasks/{task_id}. Null when nothing is to be enriched.
Serializer for what became of one data of a batch.
object
False when the data was already linked to the node.
Serializer for Datalink.
object
Return serialized data object with request context.
Parameters
obj : DataLink The object containing the data that needs to be serialized.
Returns
DatalinkDataSerializer A DatalinkDataSerializer object is being returned, with the data attribute of the input obj and the context set to include the request from the current context.
object
Return the interactor information of the object’s creator.
Parameters
obj : DataLink The object containing the creator information.
Returns
dict The interactor information of the creator.
object
Example generated
{ "task_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "created": 1, "existing": 1, "results": [ { "external_id": "example", "created": true, "datalink": { "node": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "data": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } } ]}object
object
Example
{ "code": "body_validation_error", "message": "The request body does not match the schema for the expected parameters. Check the `details` property for more details.", "details": [ { "parameter": "data", "message": "A batch holds at most <max> data, <n> were given.", "code": "invalid" } ]}object
object
Example
{ "code": "forbidden", "message": "You do not have permission to perform this operation. Check the `details` property for more details.", "details": [ { "parameter": "node", "message": "Your role does not allow creation for this node.", "code": "permission_denied" } ]}object
object
Example
{ "code": "object_not_found", "message": "Object not found. Check the `details` property for more details.", "details": [ { "parameter": "<id>", "code": "does_not_exist", "message": "\"<id>\" does not exist." } ]}object
object
Example
{ "code": "node_operation_in_progress", "message": "The requested operation cannot be performed because the node is currently in progress.", "details": [ { "parameter": "node", "message": "Node '<node id>' is currently in progress and cannot perform operation 'create_datalink'.", "code": "in_progress" } ]}
