Skip to main content

POST /links

Description

Adds a new link and returns a JSON object containing the newly created link ID.

This route processes HTTP POST requests sent to the /links endpoint.

Payload

The server expects a JSON object with the following properties:

NameTypeDescription
sourcenumber or stringRequired. The ID of the starting point of the link.
targetnumber or stringRequired. The ID of the ending point of the link.
relationstringRequired. Specifies the type of relationship the link represents.

Example:

{
"source": 1,
"target": 2,
"relation": "relatesTo"
}

Response

The response returns a JSON object with the ID of the newly created link.

Example:

{ 
"id": 1
}

The HTTP status code indicates whether the request was successful (response.status == 200) or encountered an error (response.status == 500).


Related articles: