Create Reference

POST /node/api/refs

Creates a new reference.
Permissions: objectPermissions & (modify-objects | manage-objects).

Request parameters

Body parameters

Parameter
Type
Description
client_data
string ...
...
owner
string
required
The ID of an object that should be used as a root for the created reference.
target
string
required
The ID of an object to which a reference should be created.

Response description

Field
Type
Description
client_data
string ...
...
id
string
required
The ID of the created reference.
owner
string
required
The ID of the object used as a root for the created reference.
target
string
required
The ID of the object to which the reference was created.

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
url=https://$saymon_hostname/node/api/refs
5
6
curl -X POST $url -u $login:$password \
7
-H "Content-Type: application/json" \
8
--data '{"target": "5e60d9db630502472925fe9f", "owner": "1"}'
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let path = "/node/api/refs";
5
let auth = "Basic " + btoa(login + ":" + password);
6
7
let headers = new Headers();
8
headers.append("Content-Type", "application/json");
9
headers.append("Authorization", auth);
10
11
let data = JSON.stringify({
12
"target": "5e60d9db630502472925fe9f",
13
"owner": "1"
14
});
15
16
let requestOptions = {
17
method: "POST",
18
headers: headers,
19
body: data
20
};
21
22
fetch(saymonHostname + path, requestOptions)
23
.then(response => response.text())
24
.then(result => console.log(result))
25
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let path = "/node/api/refs";
7
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
8
9
let options = {
10
"method": "POST",
11
"hostname": saymonHostname,
12
"headers": {
13
"Authorization": auth,
14
"Content-Type": "application/json"
15
},
16
"path": path
17
};
18
19
let req = http.request(options, function (res) {
20
let chunks = [];
21
22
res.on("data", function (chunk) {
23
chunks.push(chunk);
24
});
25
26
res.on("end", function (chunk) {
27
let body = Buffer.concat(chunks);
28
console.log(body.toString());
29
});
30
31
res.on("error", function (error) {
32
console.error(error);
33
});
34
});
35
36
let data = JSON.stringify({
37
"target": "5e60d9db630502472925fe9f",
38
"owner": "1"
39
});
40
41
req.write(data);
42
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
url = "https://" + saymon_hostname + "/node/api/refs"
7
8
body = {
9
"target": "5e60d9db630502472925fe9f",
10
"owner": "1"
11
}
12
13
response = requests.request("POST", url, json=body, auth=(login, password))
14
print(response.text)
Copied!

Response example

1
{
2
"target": "5e60d9db630502472925fe9f",
3
"owner": "1",
4
"id": "5e60dbdb630502472925febd"
5
}
Copied!