Equipment
Update an asset
Update an existing asset
PATCH
/
assets
/
{id}
Update an asset
curl --request PATCH \
--url https://api.oncanary.com/v1/assets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"image_url": "<string>",
"image_blur": "<string>",
"location_id": "<string>",
"serial_number": "<string>",
"manufacturer": "<string>",
"model": "<string>",
"year": 1963,
"extraFields": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
image_url: '<string>',
image_blur: '<string>',
location_id: '<string>',
serial_number: '<string>',
manufacturer: '<string>',
model: '<string>',
year: 1963,
extraFields: {}
})
};
fetch('https://api.oncanary.com/v1/assets/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.oncanary.com/v1/assets/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"image_url": "<string>",
"image_blur": "<string>",
"location_id": "<string>",
"serial_number": "<string>",
"manufacturer": "<string>",
"model": "<string>",
"year": 1963,
"extraFields": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"asset_type": "<string>",
"asset_types": [
{
"id": "<string>",
"name": "<string>"
}
],
"status": "online",
"criticality": "critical",
"serial_number": "<string>",
"manufacturer": "<string>",
"model": "<string>",
"year": 123,
"location_id": "<string>",
"parent_asset_id": "<string>",
"sub_asset_count": 1,
"deleted_at": "2023-11-07T05:31:56Z",
"image_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"extraFields": {}
},
"meta": {
"request_id": "<string>",
"api_version": "<string>"
}
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}Authorizations
Organization API key with an sk_live_ or sk_test_ prefix
Path Parameters
Resource ID
Body
application/json
Maximum string length:
255Available options:
equipment, vehicle, facility Available options:
online, offline, not_monitored Available options:
critical, important, normal Maximum string length:
1000Maximum string length:
2000Maximum string length:
255Maximum string length:
255Maximum string length:
255Manufacturing year, through the next calendar year
Required range:
1900 <= x <= 2027Label-keyed custom-field values. Omitted labels remain unchanged on update.
Show child attributes
Show child attributes
⌘I
Update an asset
curl --request PATCH \
--url https://api.oncanary.com/v1/assets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"image_url": "<string>",
"image_blur": "<string>",
"location_id": "<string>",
"serial_number": "<string>",
"manufacturer": "<string>",
"model": "<string>",
"year": 1963,
"extraFields": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
image_url: '<string>',
image_blur: '<string>',
location_id: '<string>',
serial_number: '<string>',
manufacturer: '<string>',
model: '<string>',
year: 1963,
extraFields: {}
})
};
fetch('https://api.oncanary.com/v1/assets/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.oncanary.com/v1/assets/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"image_url": "<string>",
"image_blur": "<string>",
"location_id": "<string>",
"serial_number": "<string>",
"manufacturer": "<string>",
"model": "<string>",
"year": 1963,
"extraFields": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"asset_type": "<string>",
"asset_types": [
{
"id": "<string>",
"name": "<string>"
}
],
"status": "online",
"criticality": "critical",
"serial_number": "<string>",
"manufacturer": "<string>",
"model": "<string>",
"year": 123,
"location_id": "<string>",
"parent_asset_id": "<string>",
"sub_asset_count": 1,
"deleted_at": "2023-11-07T05:31:56Z",
"image_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"extraFields": {}
},
"meta": {
"request_id": "<string>",
"api_version": "<string>"
}
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}{
"type": "https://api.oncanary.com/errors/validation_error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"request_id": "req_01JAY8FVDM6CH4R3X9Q2T7K5NP",
"code": "validation_error"
}