The recommendation is for assets to be uploaded in the previously described product import call. This can be accomplished by providing a public facing URL as an attribute value.
Within PDX, this can either remain as a URL or be downloaded and stored locally to PDX. To store the incoming assets locally, the attribute which contains the URL must be converted to type=Asset (this setup is done within the PDX UI).
If instead you want to load the raw asset into PDX, you can do this via a separate API call. Assets imported in this method are linked to the relevant products using the asset ID. This same ID needs to be stored on a product attribute which has been converted to type=Asset previously. A single asset is allowed to be referenced by multiple products.
URL | POST /asset/v1/assets/upload |
Request Headers | Authorization - authorization token. |
HTTP Status Codes | 200 - OK 401 - Unauthorized 404 - Not Found |
Response | { |
Parameter | Description | Parameter Type | Data Type |
file | file | formData | file |
contentType | Content type of the uploaded file. Optional - the service will try to detect the content type itself. For example, image/jpeg or application/pdf. | query | string |
assetId | ID to use for the uploaded asset, which can be used in the future to re-fetch assets or return asset details from other APIs. | query | string |
Example using curl:
curl -u <apiKey>:<apiSecret> -F "file=@Product_Icon.png"https://pdx.stibosystems.com/api/asset/v1/assets/upload?assetId=myTestImage
Example using Postman: