REST API Product Images Export


This resource is used to export product image data from Quant. The input format is JSON and the output format is an octet stream.

Use the Automatic Tasks section to create and set up an export. Once created, the task list will have the ID that you pass in the request URL.

Automatic Task

Task ID

  • Settings

Before using the API, you must edit the following attributes in the Settings tab:

  • Check the Enabled attribute to enable the task.
  • In the Users with API Access Permission, select one or more users with the Robot role who will have permission to run the task.
  • Attributes
Attribute
Description
Type
Enabled
Specifies whether the user can access this resource.
yes/no
Title
Custom name of the automated task.
text
Description
Custom description of the automatic task function.
formatted text
Notes
Notes.
long text
Users with API Access Permission
Users with the Robot role who are authorized to run the task.
list of users
Delay in Seconds before Retrying
If the status code is 503, the client should wait for this number of seconds before retrying the request.
number
Matching Attribute
Which matching attribute should the data be exported based on? For example primary product ID or the name
complex type
Settings
  • Request

/v1/export/product-image/{task_id}

Parameter
Value
URL
?debug added to the URL will also display a warning in the response. Without it, only errors are listed.
Header
Accept: application/octet-stream
Header
Content-type: application/json
Header

Authorization: Bearer  <TOKEN>

TOKEN is obtained via /authenticate (see Login).

Method
POST

The request body is a JSON object that contains the following keys:

Key
Value
ProductId
When making request, you must specify the product for which the image is to be exported. In the tasks settings, under the Matching Attribute field, you can select the matching attribute to be sent with the ProductId value in the request. Only one product can be selected at a time.
Example:

{“ProductId”: “10001”.

  • Response

The response returns the front image of the product's default packaging in octet-stream format. If there are multiple products matching the product ID, an image of one of the matching products will be sent at random. To view the product, download the response and save it in .png or .jpg format.

  • Status Condes
Status
Význam
200 OK
The export was successful. The product image was returned.
204 No Content
     Either the product does not exist in Quant, or there is no image for it.
400 Bad Request
Incorrect task settings or incorrect request.
401 Unauthorized
The authorisation token is invalid, or the user who is logged on with the token does not have permission to run this task.
404 Not Found
No task was found with the ID specified in the URL.
500 Internal Server Error

A critical server-side occurred during the export.

  • Latest Logs

In Quant, in addition to configuring tasks, you can also view logs of individual export runs, including statistics, errors and warnings.

Latest logs

The Latest Logs tab allows us to select a specific record and view any errors and warnings linked to it.

Record details


  • Request

curl -X POST --location "http://localhost:4150/v1/export/product-image/1076664" \
    -H "Authorization: Bearer <API_TOKEN>" \
    -H "Accept: application/octet-stream" \
    -H "Content-Type: application/json" \
    -H "Cache-Control: no-cache" \
-d '{ \"ProductId\": \"100001\"}'

  • Response

{
  ����JFIF��C     %# , #&')*)-0-(0%()(��C  (((((((((((((((((((((((((((((((((((((((((((((((((((�� �"��   ���}!1AQa"q2���#B��R��$3br�  %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���������������������������������������������������������������������������   ���w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������� ?���(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��
  ...
}