Skip to content

nodes_datalinks_batch_create

POST
/api/nodes/{node_pk}/datalinks/batch
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.

node_pk
required
string format: uuid
X-Workspace
required
string format: uuid

Workspace ID

Serializer for a batch of data of a connection, given by their external ids.

object
connection
required
string format: uuid
data
required
Array<object>

Serializer for one data of a batch, given by its external id.

object
external_id
required
string
<= 1000 characters
name

Name shown until the data is read from its source, which then replaces it. Defaults to the external id.

string
<= 1000 characters

Example generated

{
"connection": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"data": [
{
"external_id": "example",
"name": "example"
}
]
}
Media typeapplication/json

Serializer for the answer to the creation of a batch of datalinks.

object
task_id
required

Task enriching the created datalinks, to follow with GET /api/tasks/{task_id}. Null when nothing is to be enriched.

string format: uuid
nullable
created
required
integer
existing
required
integer
results
required
Array<object>

Serializer for what became of one data of a batch.

object
external_id
required
string
created
required

False when the data was already linked to the node.

boolean
datalink
required

Serializer for Datalink.

object
id
required
string format: uuid
node
required
string format: uuid
data
required
string format: uuid
data_obj
required

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
key
additional properties
created_by
required

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
key
additional properties
created_time
required
string format: date-time

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"
}
}
]
}
Media typeapplication/json

Serializer for the answer to the creation of a batch of datalinks.

object
task_id
required

Task enriching the created datalinks, to follow with GET /api/tasks/{task_id}. Null when nothing is to be enriched.

string format: uuid
nullable
created
required
integer
existing
required
integer
results
required
Array<object>

Serializer for what became of one data of a batch.

object
external_id
required
string
created
required

False when the data was already linked to the node.

boolean
datalink
required

Serializer for Datalink.

object
id
required
string format: uuid
node
required
string format: uuid
data
required
string format: uuid
data_obj
required

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
key
additional properties
created_by
required

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
key
additional properties
created_time
required
string format: date-time

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"
}
}
]
}
Media typeapplication/json
object
code
required
string
>= 1 characters
message
required
string
>= 1 characters
details
required
Array<object>
object
parameter
string
nullable
code
string
nullable
message
string

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"
}
]
}
Media typeapplication/json
object
code
required
string
>= 1 characters
message
required
string
>= 1 characters
details
required
Array<object>
object
parameter
string
nullable
code
string
nullable
message
string

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"
}
]
}
Media typeapplication/json
object
code
required
string
>= 1 characters
message
required
string
>= 1 characters
details
required
Array<object>
object
parameter
string
nullable
code
string
nullable
message
string

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."
}
]
}
Media typeapplication/json
object
code
required
string
>= 1 characters
message
required
string
>= 1 characters
details
required
Array<object>
object
parameter
string
nullable
code
string
nullable
message
string

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"
}
]
}