Edit in GitHubLog an issue

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.

Copied to your clipboard
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.

Copied to your clipboard
GET /rest/v1/files/uploads/:file_upload_id

Parameters:

FieldTypeDescription
file_upload_id
URL element
The file_upload_id string that was returned when uploading or listing the file.
offset
int
Index of the first element to return in the response. Used for pagination.
limit
int
Maximum number of list items to return in the response. Used for pagination.

Sorting 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.

Copied to your clipboard
curl -X GET \
-H 'Authorization: Bearer baGXoStRuR9VCDFQGZNzgNqbqu5WUwlr.cAxZJ9m22Le7' \
https://commercedeveloper-sandbox-api.adobe.com/rest/v1/files/uploads/5c129cd41ba478.65767699.1

Response field details:

FieldTypeDescription
file_upload_id
string
Unique identifier for the file.
filename
string
The name of the file sent in the request.
content_type
string
The mime-type for which the file was uploaded.
size
integer
The size of the file in bytes.
malware_status
string
Malware check result for this file. Valid values include: pass, fail, in-progress.
file_hash
string
Hash of the file; currently md5. Only set if malware_status is pass.
url
string
The URL from which the file may be downloaded, if applicable.
submission_ids
array
The list of package submissions associated with this file, if any.

The 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.

Copied to your clipboard
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:

Copied to your clipboard
Content-Type: multipart/form-data; boundary=UNIQUE_BOUNDARY_TOKEN

For more info on multipart/form-data requests, see the IETF specification

Copied to your clipboard
--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:
ElementTypeDescription
Content-Disposition
string
MUST be form-data
name
string
MUST be file[] for all parts.
filename
string
Should be the original name of the file.
Content-Type
string
Should be the correct mime-type for the file.

Recognized Content-Types

File TypeRecognized Content-TypeUsage
png
image/png
avatar, gallery
jpg / jpeg
image/jpeg
avatar, gallery
gif
image/gif
avatar
pdf
application/pdf
document
zip
application/zip
package
zip
application/x-zip-compressed
package
zip
application/octet-stream
package

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:

Copied to your clipboard
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

Each record in the list has the following fields:

FieldTypeDescription
filename
string
The name of the file sent in the request.
content-type
string
The mime-type of the uploaded file.
size
integer
The size of the file in bytes.
file_upload_id
string
A unique identifier for the file.

The file_upload_id must be tracked for subsequent package submission API endpoints.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.