Request: POST /papi/v1/asset/[Asset id]/attachment/[Attachment id]/upload/[File name]
Uploads a file to an asset as an attachment. Attachment id is mandatory and can be accessed via UI or attachment type API command.
There is two ways defining the attachment ids, using system generated (integer) or user given (string).
Parameter | Parameter Type | Mandatory | Description |
---|---|---|---|
Asset id | Path | yes | Unique asset id to upload the new version. |
Attachment id | Path | yes |
|
File name | Path | yes | Filename containing the extension. |
File content | Body | yes | Request body containing the file as a binary file. |
x-auth-token | Header | yes | The authentication token must be provided as a x-auth-token header for every api request. More information about authentication token. |
Response: JSON – Asset object.
Attachment id(s) can be found from path $.AttachedFiles..FileInfo..Id
...
"AttachedFiles": [
{
"AttachmentType": "imagePNG",
"FileInfo": {
"Id": "1070",
...
cURL example
curl --location --request POST 'https://[EMMi instance]/papi/v1/asset/[Asset id]/attachment/[Attachment id]/upload/image.png' \
--header 'x-auth-token: [Session token]' \
--header 'Content-Type: image/png' \
--data-binary '@Downloads/robot1.png'
Tips:
To get the available attachments and ids, use the attachment type command.
Request: GET /papi/v1/asset/attachmenttype
Parameter | Parameter Type | Mandatory | Description |
---|---|---|---|
x-auth-token | Header | yes | The authentication token must be provided as a x-auth-token header for every api request. More information about authentication token. |
Response: JSON – Attachment details.
Attacment id’s JSON path is: $..Identifier
[
{
"Identifier": "photoshopFile",
"Name": {
"x-default": "Photoshop File"
},
...
]
Post your comment on this topic.