Avatar
Upload the image shown for a tracker in the interface.
A tracker's avatar is the image the interface shows for it in lists and on the map. This operation uploads one, replacing whatever the tracker had before.
The upload is a multipart request rather than JSON, and the accepted image formats are image/jpeg, image/pjpeg, image/png, image/gif, and image/webp.
API actions
API base path: /tracker/avatar.
Required sub-user rights: tracker_update.
Upload an avatar image for a tracker. Multipart request, with the image in a part named file.
Accepted MIME types are image/jpeg, image/pjpeg, image/png, image/gif and image/webp. Once uploaded the image is served from /[api_static_path]/tracker/avatars/<file_name>, for example https://api.eu.navixy.com/v2/static/tracker/avatars/abcdef123456789.png.
Requires the tracker_update right.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the tracker, also known as the object ID. Must belong to the current account and not be blocked.
123456The image file.
Optional. URL to redirect to. When given, the response is a redirect to <redirect_target>?response=<urlencoded_response_json> instead of a JSON body.
The uploaded avatar
true if request finished successfully.
trueFile name of the stored avatar.
Bad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 201: no tracker with this ID belongs to the account. Error 208: the tracker exists but is blocked, normally because its tariff ended. Error 233: no file part was sent. Error 234: the file has an unaccepted MIME type. Error 254: the file could not be saved.
Error response object
POST /v2/tracker/avatar/upload HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: multipart/form-data
Accept: */*
Content-Length: 62
{
"tracker_id": 123456,
"file": "binary",
"redirect_target": "text"
}{
"success": true,
"value": "text"
}Errors
These errors come in addition to the general error codes:
201 - No tracker with this ID belongs to the account.
208 - The tracker exists but is blocked, normally because its tariff ended.
233 - No file part was sent.
234 - The file has an unaccepted MIME type.
254 - The file could not be saved.
Last updated
Was this helpful?