Upload Image Asset
POST
/merchants/{merchantCode}/images
const url = 'https://cms.shopgate.io/v1/merchants/example/images';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST'};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://cms.shopgate.io/v1/merchants/example/images \ --header 'Content-Type: multipart/form-data' \ --form file=@fileUploads an image to the Shopgate CDN. Returns a base URL that can be used within widget configurations.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”merchantCode
required
string
FormData Parameters
Section titled “FormData Parameters”file
required
file
The file to upload. Must be eiter a .jpg or .png file.
Responses
Section titled “Responses”Url of the uploaded file
Media typeapplication/json
object
baseUrl
string
Examplegenerated
{ "baseUrl": "example"}Validation error
Media typeapplication/json
object
statusCode
number
message
string
code
string
additionalInfo
object
validationErrors
Array<object>
object
code
number
reason
string
entity
string
entityId
string
subentityPath
Array<string | number>
error
object
paramName
The parameter-field, that failed to validate, like “userId”
string
paramValue
The value, that was sent, like “xxx”
null | string | number | array | object
code
Machine readable error code
string
message
required
Human readable error code
string
results
object
errors
Array<object>
object
code
Machine readable error code
string
message
Human readable error code
string
description
string
path
Array<string>
warnings
array
Example
{ "error": { "code": "SCHEMA_VALIDATION_FAILED", "results": { "errors": [ { "code": "MAX_LENGTH", "message": "Name too long", "description": "Property Name is too long", "path": [ "name" ] } ] } }}Insufficient permissions
Media typeapplication/json
object
code
Machine readable error code
string
message
required
Human readable error code
string
Examplegenerated
{ "code": "example", "message": "example"}Merchant not found
Media typeapplication/json
object
statusCode
number
code
required
string
message
required
string
Example
{ "code": "NotFound", "message": "Merchant not found"}
