Scripts
Note: The nsfilter (namespace filter) query parameter is mandatory for every request. It sets the context, helping you look up resources within that namespace. Example: GET /itemsvc/api/v1/nameduseritems?nsfilter=proj_DrZrSNrW
Create Scripts#
Endpoints#
POST /itemsvc/api/v1/nameduseritemsRequest#
Query parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
transactional | String | Set to true to make the request transactional. | Optional |
nsfilter | String | namespace context | Required |
Body parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
_name | String | Readable long-form name | Required |
_shortName | String | An abbreviated name up to 22 characters that is used for reference | Required |
_description | String | Describes the purpose of the Script | Required |
_namespaces | String | An array of namespaces you want to add the Script to | Required |
_userType | String | A user-defined type for the Script that you can use to distinguish or group it by. | Required |
_itemClass | String | Enter "Script". | Required |
_version._userData | Object | Script data. | Required |
Example:
[ { "_name": "General Medical Architecture", "custom_field": "General Medical Architecture", "_shortName": "genmedarch", "_description": "General Medical Architecture model with Doors view", "_userType": "upload_script", "_namespaces": [ "lntpurelocal_Xw6AQru7" ], "_itemClass": "Script", "_version": { "_userData": "[{\"$setq\": {\"eh_record_actions\": [{\"collection\": \"eh_files\",\"action\": \"addFiles\"},{\"collection\": \"eh_tasks\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_issues\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_things\",\"action\": \"addRelatedRecord\"},{\"label\": \"Geometry\",\"icon\": \"glyphicons vector_path_polygon\",\"action\": \"addDocGeometry\"}]}}]" } }]Response#
Response codes#
| Code | Description |
|---|---|
201 | Created |
400 | Bad Request |
Response body example#
{ "_pageSize": 1, "_list": [ { "_uri": "/nameduseritems/5cf11bd8e4ee9b4ce37b50d6", "_name": "General Medical Architecture", "_userType": "upload_script", "_tipId": "5cf11bd8e4ee9b4ce37b50d7", "_versions": [ { "_userItemDbId": "5cf11bd8e4ee9b4ce37b50d6", "_id": "5cf11bd8e4ee9b4ce37b50d7", "_isTip": true, "_metadata": { "_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_createdAt": 1559305176250, "_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_updatedAt": 1559305176250 }, "_version": 1, "_userData": "[{\"$setq\": {\"eh_record_actions\": [{\"collection\": \"eh_files\",\"action\": \"addFiles\"},{\"collection\": \"eh_tasks\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_issues\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_things\",\"action\": \"addRelatedRecord\"},{\"label\": \"Geometry\",\"icon\": \"glyphicons vector_path_polygon\",\"action\": \"addDocGeometry\"}]}}]" } ], "_irn": "itemsvc:nameduseritem:5cf11bd8e4ee9b4ce37b50d6", "_namespaces": [ "lntpurelocal_Xw6AQru7" ], "_nextVersion": 2, "_shortName": "genmedarch", "_tipVersion": 1, "_versionsCount": 1, "_itemClass": "Script", "_userItemId": "genmedarch_SJdvp3Ovbc", "_id": "5cf11bd8e4ee9b4ce37b50d6", "_description": "General Medical Architecture model with Doors view", "_metadata": { "_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_createdAt": 1559305176249, "_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_updatedAt": 1559305176249 }, "_kind": "script" } ], "_offset": 0, "_total": 1}Get Script by Id#
Endpoints#
GET /itemsvc/api/v1/nameduseritems/{id}Request#
Path parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | The Script's _userItemId | Required |
Query parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
project | Object | Field projections to exclude or include fields in the response, for example, project={"_metadata":0} or project={"_versions._userData":1}. | Optional |
nsfilter | String | namespace context | Required |
Note:
_versionsarray always contains current version only. To get all the versions for a named user item useGET /nameduseritems/{id}/versionsorGET /nameduseritemswith_versions.alloption
Response#
Response codes#
| Code | Description |
|---|---|
200 | Success |
400 | Bad Request |
404 | File Not Found |
Response#
{ "_uri": "/nameduseritems/5cf11d69f57ff413fa9c951b", "_tipVersion": 2, "_itemClass": "Script", "_userItemId": "genmedarch_G9aBVeQlRp", "_tipId": "5cf11d78f57ff413fa9c951d", "_versions": [ { "_userItemDbId": "5cf11d69f57ff413fa9c951b", "_id": "5cf11d78f57ff413fa9c951d", "_userData": "[{\"$setq\": {\"eh_record_actions\": [{\"collection\": \"eh_files\",\"action\": \"addFiles\"},{\"collection\": \"eh_tasks\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_issues\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_things\",\"action\": \"addRelatedRecord\"},{\"label\": \"Geometry\",\"icon\": \"glyphicons vector_path_polygon\",\"action\": \"addDocGeometry\"}]}}]" } ], "_irn": "itemsvc:nameduseritem:5cf11d69f57ff413fa9c951b", "_id": "5cf11d69f57ff413fa9c951b", "_kind": "script"}Get Scripts by Query#
Endpoints#
GET /itemsvc/api/v1/nameduseritemsRequest#
Query parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
query | Object | Pass a query object with query parameters and values based on the NamedUserCollection class. You can also use query operators. To query all versions of NamedUserCollections rather than just the latest versions, add the query property and value _versions.all: true. For query examples, see Query parameter examples. | Optional |
project | Object | Field projections to exclude or include fields in the response, for example, project={"_metadata":0}. | Optional |
page | Object | Pass a Page object that defines the response pagination, for example, ?page={"_offset": 0, "_pageSize" 100} | Optional |
sort | Object | Pass a sort object to define the response sort order by a given property, using 1 for ascending sort and -1 for descending sort, for example, ?sort={"_name":1} | Optional |
userItemVersionId | Object | Lookup RelatedItems for a given NamedUserCollection version, rather than the current version. | Optional |
nsfilter | String | namespace context | Required |
Query examples#
# searches by name, the response would have tip version only:?query={"_name": "General Medical Architecture Script"}
# searches by item class, has all the versions?query={"_itemClass": "Script","_versions.all":true}
# searches against all the versions and returns all the versions matching?query={"$and": [{"_itemClass": "Script"},{"_versions._userAttributes.key":"value"}],"_versions.all":true}
# searches against latest version?query={"$and": [{"_itemClass": "Script"},{"_versions._userAttributes.key":"value":"value"}]} Response#
Response codes#
| Code | Description |
|---|---|
200 | Success |
404 | File Not Found |
Response data example#
{ "_pageSize": 1, "_list": [ { "_uri": "/nameduseritems/5cf11d69f57ff413fa9c951b", "_name": "General Medical Architecture", "_userType": "upload_script", "_tipId": "5cf11d78f57ff413fa9c951d", "_versions": [ { "_userItemDbId": "5cf11d69f57ff413fa9c951b", "_id": "5cf11d69f57ff413fa9c951c", "_isTip": false, "_metadata": { "_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_createdAt": 1559305577949, "_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_updatedAt": 1559305592242 }, "_version": 1, "_userData": "[{\"$setq\": {\"eh_record_actions\": [{\"collection\": \"eh_files\",\"action\": \"addFiles\"},{\"collection\": \"eh_tasks\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_issues\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_things\",\"action\": \"addRelatedRecord\"},{\"label\": \"Geometry\",\"icon\": \"glyphicons vector_path_polygon\",\"action\": \"addDocGeometry\"}]}}]" }, { "_userItemDbId": "5cf11d69f57ff413fa9c951b", "_id": "5cf11d78f57ff413fa9c951d", "_isTip": true, "_metadata": { "_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_createdAt": 1559305592225, "_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_updatedAt": 1559305592244 }, "_version": 2, "_userData": "[{\"$setq\": {\"eh_record_actions\": [{\"collection\": \"eh_files\",\"action\": \"addFiles\"},{\"collection\": \"eh_tasks\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_issues\",\"action\": \"addRelatedRecord\"},{\"collection\": \"eh_things\",\"action\": \"addRelatedRecord\"},{\"label\": \"Geometry\",\"icon\": \"glyphicons vector_path_polygon\",\"action\": \"addDocGeometry\"}]}}]" } ], "_irn": "itemsvc:nameduseritem:5cf11d69f57ff413fa9c951b", "_namespaces": [ "lntpurelocal_Xw6AQru7" ], "_nextVersion": 3, "_shortName": "genmedarch", "_tipVersion": 2, "_versionsCount": 2, "_itemClass": "Script", "_userItemId": "genmedarch_G9aBVeQlRp", "_id": "5cf11d69f57ff413fa9c951b", "_description": "General Medical Architecture model with Doors view", "_metadata": { "_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_createdAt": 1559305577901, "_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c", "_updatedAt": 1559305592231 }, "_kind": "script" } ], "_offset": 0, "_total": 1}Delete Script by Id#
Endpoints#
DELETE /itemsvc/api/v1/nameduseritems/{id}Request#
Path parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | The Script's _userItemId | Required |
Query parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
transactional | Boolean | Set to true to make the request transactional. | Required |
nsfilter | String | namespace context | Required |
Response#
Response codes#
| Code | Description |
|---|---|
204 | No Content |
404 | File Not Found |
Response#
None
Get Update Logs for Named User Item#
Endpoints#
GET /itemsvc/api/v1/nameduseritems/{id}/updatelogsRequest#
Query parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
transactional | Boolean | Set to true to make the request transactional. | Required |
nsfilter | String | namespace context | Required |
Path parameters#
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | The Script's _userItemId | Required |
Response#
Response codes#
| Code | Description |
|---|---|
200 | Success |
404 | File Not Found |
Response#
[ { "_updatedBy": "1b457660-92c2-461d-9895-78e731a031c6", "_updatedAt": 1542267364347 }]