Files
Use the files resource to manage all artifacts that you upload:
- Magento 2 ZIP files (.zip)
- PDF documents for user guides, installation guides, and reference manuals
- Product icons
- Image files for galleries
- Image files for your personal and company profile
Each file upload receives a unique ID. You must associate these IDs with your submission later using the packages API.
You can associate a file with multiple products. This allows for asset sharing across different packages. For example, you can share an image file for a gallery with different packages by associating it with the same file upload ID.
All files that you upload are inspected for malware. We only accept packages for further review if all associated files have passed the malware inspection.
File uploads
Use this API to upload files, retrieve file upload status, and remove files.
GET /rest/v1/files/uploads/:file_upload_id
POST /rest/v1/files/uploads
Get a file upload
Use the upload ID to retrieve details about a file upload.
GET /rest/v1/files/uploads/:file_upload_id
Parameters:
file_upload_idfile_upload_id string that was returned when uploading or listing the file.offsetlimitSorting and filtering parameters are currently not available for this endpoint.
If the file_upload_id parameter is specified, a single file record will be returned. If it is omitted, then a batch response will be returned: an array of records for all files uploaded by the current user.
data-slots=heading, code
data-repeat=2
data-languages=CURL, JSON
Request
curl -X GET \
-H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
https://commercedeveloper-sandbox-api.adobe.com/rest/v1/files/uploads/5c129cd41ba478.65767699.1
Response
{
"file_upload_id" : "5c129cd41ba478.65767699.1",
"filename" : "icon.png",
"content_type" : "image/png",
"size" : 123456,
"malware_status" : "pass",
"file_hash" : "f53f5db985b8815f1ce6fd4b48a0439a",
"submission_ids" : [
],
"is_profile_image" : false,
"url" : "https://commercedeveloper-sandbox-static.adobe.com/user/68/f3/68f360d3516f594fc957c4179ed4a7a872911f07/pub/f5/3f/f53f5db985b8815f1ce6fd4b48a0439a/icon.png"
}
Response field details:
file_upload_idfilenamecontent_typesizemalware_statuspass, fail, in-progress.file_hashpass.urlsubmission_idsThe order of fields may differ, and additional fields may also be returned.
Upload files
Upload files in bulk using the multipart/form-data encoding type. With this approach, binary files can be uploaded without the need for additional encoding, which could otherwise result in an increase in overall upload size.
POST /rest/v1/files/uploads
A sample request body of mime type, multipart/form-data with a boundary string of UNIQUE_BOUNDARY_TOKEN is shown below:
data-variant=info
data-slots=text
Content-Type: multipart/form-data; boundary=UNIQUE_BOUNDARY_TOKEN
For more info on multipart/form-data requests, see the IETF specification
--UNIQUE_BOUNDARY_TOKEN
Content-Disposition: form-data; name="file[]"; filename="acme_one-click-checkout.zip"
Content-Type: application/zip
<zip file content here.....>
--UNIQUE_BOUNDARY_TOKEN
Content-Disposition: form-data; name="file[]"; filename="icon.png"
Content-Type: image/png
<image file content here.....>
--UNIQUE_BOUNDARY_TOKEN
Content-Disposition: form-data; name="file[]"; filename="acme-logo.png"
Content-Type: image/png
<image file content here.....>
--UNIQUE_BOUNDARY_TOKEN
Content-Disposition: form-data; name="file[]"; filename="user.pdf"
Content-Type: application/pdf
<pdf file content here....>
--UNIQUE_BOUNDARY_TOKEN--
- Each part has a header and body.
- The body of each part is the full contents of the raw file.
- The header has the following required elements:
form-datafile[] for all parts.Recognized Content-Types
If the request body given above was saved into a temporary file at /tmp/files-payload, you may use it in your POST request to upload the files:
data-slots=heading, code
data-repeat=2
data-languages=CURL, JSON
Request
curl -X POST \
-H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
-H "Content-Type: multipart/form-data; boundary=UNIQUE_BOUNDARY_TOKEN" \
--data-binary @/tmp/files-payload \
https://commercedeveloper-sandbox-api.adobe.com/rest/v1/files/uploads
Response
[
{
"filename" : "acme_one-click-checkout.zip",
"content_type" : "application/zip",
"size" : 182934,
"file_upload_id" : "5c11e656057b42.97931218.5"
},
{
"filename" : "icon.png",
"content_type" : "image/png",
"size" : 37492,
"file_upload_id" : "5c129cd41ba478.65767699.1"
},
{
"filename" : "acme-logo.png",
"content_type" : "image/png",
"size" : 6825,
"file_upload_id" : "5c644fa344e5d7.04253635.8"
},
{
"filename" : "user.pdf",
"content_type" : "application/pdf",
"size" : 48392,
"file_upload_id" : "5c644d97bb7c41.37505716.6"
}
]
data-variant=info
data-slots=text
Each record in the list has the following fields:
The file_upload_id must be tracked for subsequent package submission API endpoints.