Manage data source media

POST/homes/{homeId}/dataSources/{dataSourceKey}/manageMedia

Base URL: https://api.tinkermode.com

Manage image data associated with a data source. 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 data source, a service account token with the same permission, or a project API key with admin permission.

Path parameters

NameTypeRequiredConstraintsDescription
homeIdintegerYesThe unique ID for a specified home.
dataSourceKeystringYesA compound key consisted catalogId, sourceId, and deviceId with the separator :: e.g. bu01::a4dd89297bfd::1234. The device ID is optional when the data source is associated with integration module e.g. heartbeat::sensor-1 or heartbeat::sensor-1::0

Request body

Content type: application/json

PropertyTypeRequiredConstraintsDescription
actionstringYesone of: open-upload, close-upload, deleteAction to be taken.
fileNamestringNoFilename of the image. Needed only if requesting to open an upload.
targetstringYesone of: imageWhich media the action should be applied to.

Request example

{
  "action": "open-upload",
  "fileName": "thumbnail.png",
  "target": "image"
}

Responses

200 Request to upload an 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 image file.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
uploadUrlstringNoA signed URL for uploading the media file.

204 Request to complete an upload, or to delete an image, was successful.

401 Authorization is required to access this resource.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of invalid data or denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.