Named User Item Version
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/662e2ec34ba9506e99ee04b1/versions?nsfilter=proj_DrZrSNrW
Get Versions
Endpoints
GET /itemsvc/api/v1/nameduseritems/{id}/versions
Request
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | Pass the NamedUserItem _id or _userItemId value. | Required |
Query parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
query | Object | Pass a query object with query parameters and values based on the NamedUserItem class. You can also use query operators. To query all versions of NamedUserItems 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 parameter 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 body
{
"_pageSize": 2,
"_list": [
{
"_userItemDbId": "5cf129f3213fc97f7dbf24fb",
"_id": "5cf12ac9213fc97f7dbf24fd",
"_isTip": false,
"_metadata": {
"_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_createdAt": 1559309001292,
"_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_updatedAt": 1559309357969
},
"_version": 2,
"_userData": {
"accountid": 4,
"modelid": 6,
"file_name": "General Medical Architecture.bimpk",
"projectid": 5
}
},
{
"_userItemDbId": "5cf129f3213fc97f7dbf24fb",
"_id": "5cf12c2d213fc97f7dbf24fe",
"_isTip": true,
"_metadata": {
"_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_createdAt": 1559309357951,
"_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_updatedAt": 1559309357970
},
"_version": 3,
"_userData": {
"accountid": 4,
"modelid": 6,
"file_name": "General Medical Architecture.bimpk",
"projectid": 5
}
}
],
"_offset": 0,
"_total": 2
}
Add a Version to Named User Item
Endpoints
POST /itemsvc/api/v1/nameduseritems/{id}/versions
Request
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | Pass the NamedUserItem _id or _userItemId value. | Required |
Query
| Parameter | Type | Description | Required |
|---|---|---|---|
transactional | Object | Set to true to process the request transactional. | Optional |
nsfilter | String | namespace context | Required |
Body parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
_userData | Object | Add custom data | Optional |
_userAttributes | Object | Add custom attributes | Optional |
Body example
{
"_userData": {
"accountid": 4,
"modelid": 6,
"file_name": "General Medical Architecture.bimpk",
"projectid": 5
},
"_userAttributes": {
"collections": {
"projects": {
"handler": "projects"
}
}
}
}
Response
Response codes
| Code | Description |
|---|---|
201 | Created |
404 | File Not Found |
Response data
{
"_userAttributes": {
"collections": {
"projects": {
"handler": "projects"
}
}
},
"_userItemDbId": "5cf129f3213fc97f7dbf24fb",
"_isTip": true,
"_id": "5cf12d35213fc97f7dbf24ff",
"_metadata": {
"_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_createdAt": 1559309621456,
"_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_updatedAt": 1559309621456
},
"_version": 4,
"_userData": {
"accountid": 4,
"modelid": 6,
"file_name": "General Medical Architecture.bimpk",
"projectid": 5
}
}
Update Version
Endpoints
PUT /nameduseritems/{id}/versions/{versionId}
Request
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | Pass the NamedUserItem _id or _userItemId value. | Required |
versionId | String | Pass the NamedUserItem version's id. | Required |
Query parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
transactional | Boolean | Set to true to make the request transactional. | Optional |
nsfilter | String | namespace context | Required |
Body parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
_userData | Object | Add custom data | Optional |
_userAttributes | Object | Add custom attributes | Optional |
Body example
{
"_userData": {
"accountid": 4,
"modelid": 6,
"file_name": "General Medical Architecture.bimpk",
"projectid": 5
},
"_userAttributes": {
"collections": {
"projects": {
"handler": "projects"
}
}
}
}
Response
Response codes
| Code | Description |
|---|---|
201 | Created |
404 | File Not Found |
Response data
{
"_userAttributes": {
"collections": {
"projects": {
"handler": "projects"
}
}
},
"_userItemDbId": "5cbdbd42b43f1d0001852ade",
"_isTip": true,
"_id": "5cf12ec1e4ee9b4ce37b50d9",
"_metadata": {
"_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_createdAt": 1559310017174,
"_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_updatedAt": 1559310017174
},
"_version": 2,
"_userData": {
"accountid": 4,
"modelid": 6,
"file_name": "General Medical Architecture.bimpk",
"projectid": 5
}
}
Get a Version by Id
Endpoints
GET /nameduseritems/{id}/versions/{versionId}
Request
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | Pass the NamedUserItem _id or _userItemId value. | Required |
versionId | String | Pass the NamedUserItem version's id. | Required |
nsfilter | String | namespace context | Required |
Response
Response codes
| Code | Description |
|---|---|
200 | Success |
404 | File Not Found |
Response data
{
"_userAttributes": {
"collections": {
"projects": {
"handler": "projects"
}
}
},
"_userItemDbId": "5cbdbd42b43f1d0001852ade",
"_id": "5cf12ec1e4ee9b4ce37b50d9",
"_isTip": true,
"_metadata": {
"_updatedById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_createdAt": 1559310017174,
"_createdById": "17285382-7f67-4b04-b231-bcdca454ed2c",
"_updatedAt": 1559310317796
},
"_version": 2,
"_userData": {
"accountid": 4,
"modelid": 6,
"file_name": "General Medical Architecture.bimpk",
"projectid": 5
}
}
Delete a Version
Note: You can't delete all versions-at least one version must exist unless you delete the NamedUserItem itself.
Note: If you delete the latest version, the previous version becomes the latest version
Endpoints
DELETE /nameduseritems/{id}/versions/{versionId}
Request
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | Pass the NamedUserItem _id or _userItemId value. | Required |
versionId | String | Pass the NamedUserItem version's id. | Required |
Query parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
transactional | Boolean | Set to true to make the request transactional. | Optional |
nsfilter | String | namespace context | Required |
Response
Response codes
| Code | Description |
|---|---|
204 | No Content |
400 | Bad Request |
Response
None