Manage entity media
POST/projects/{projectId}/entities/{entityId}/manageMedia
Base URL: https://api.tinkermode.com
Manage icon and image associated with an entity instance. The client may
use this method to upload or delete the media. To upload media, the client
must first acquire an upload URL by using the open-upload action in the request body.
After completing the upload (by making a PUT request to the upload URL), the client
must explicitly "close" the upload by using the close-upload action in the request body.
Authentication
Send an Authorization header of the form ModeCloud <AUTH_CODE>.
Must contain a user API key of a user with permission to update the entity instance, a service account token with the same permission, or a project API key with admin permission.
Path parameters
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
projectId | integer | Yes | The unique ID for a specified project. | |
entityId | string | Yes | Entity ID (unique within project) |
Request body
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
action | string | Yes | one of: open-upload, close-upload, delete | Action to be taken. |
fileName | string | No | Filename of the icon or image. Needed only if requesting to open an upload. | |
target | string | Yes | one of: icon, image | Which media the action should be applied to. |
Request example
{
"action": "open-upload",
"fileName": "freezer-icon.png",
"target": "icon"
}Responses
200 Request to upload an icon or image was successful. The response
body is a JSON object that contains a signed upload URL. The client
should make a PUT request with that URL to upload the icon or image file.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
uploadUrl | string | No | A signed URL for uploading the media file. |
204 Request to complete an upload, or to delete an icon/image, was successful.
401 Authorization is required to access this resource.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
403 Request failed because of invalid data or denied permission.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
429 Request failed because of rate limit.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
500 An unexpected error has occurred.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
503 The service is temporarily unavailable.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |