Clone Object

POST /node/api/objects/:id/clone

Clones an object and returns its JSON representation.
Permissions: create-object | manage-objects.

Request parameters

Path parameters

Parameter
Type
Description
id
String
required
The ID of an object to be cloned.

Response description

See the Object model.

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
object_id=<...>
5
url=https://$saymon_hostname/node/api/objects/$object_id/clone
6
7
curl -X POST $url -u $login:$password
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let objectId = <...>
5
let path = "/node/api/objects/" + objectId + "/clone";
6
let auth = "Basic " + btoa(login + ":" + password);
7
8
let headers = new Headers();
9
headers.append("Content-Type", "application/json");
10
headers.append("Authorization", auth);
11
12
let requestOptions = {
13
method: "POST",
14
headers: headers
15
};
16
17
fetch(saymonHostname + path, requestOptions)
18
.then(response => response.text())
19
.then(result => console.log(result))
20
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let objectId = <...>
7
let path = "/node/api/objects/" + objectId + "/clone";
8
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
9
10
let options = {
11
"method": "POST",
12
"hostname": saymonHostname,
13
"headers": {
14
"Authorization": auth
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
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
object_id = <...>
7
url = "https://" + saymon_hostname + "/node/api/objects/" + \
8
object_id + "/clone"
9
10
response = requests.request("POST", url, auth=(login, password))
11
print(response.text)
Copied!

Response example

1
{
2
"id": "5e79baae6ec5ea28e5105caa",
3
"name": "Updated Object",
4
"owner_id": "5e21b752308c3c66d64e072c",
5
"client_data": "{...}",
6
"object_groups": [],
7
"geoposition": [],
8
"child_ref_ids": [],
9
"child_link_ids": [],
10
"child_ids": [],
11
"parent_id": "1",
12
"weight": 1,
13
"tags": [],
14
"last_state_update": 1585035950051,
15
"updated": 1585035950051,
16
"created": 1585035085802,
17
"state_id": 1,
18
"class_id": 13,
19
"_stateConditionRefs": [],
20
"operations": [],
21
"properties": []
22
}
Copied!
Last modified 1yr ago