REST API Basic Entity Import V1
This source is used to import basic entity such as store, category or planned replacements into Quant. The input and output format is JSON.
Use the Automatic Tasks section to create and set up an import. Once created, the task list will have the ID that you pass in the request URL.
- 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.
- In the Basic Entity for Import, select the entity you want to import.
- In the Matching Atribute, select the atribute to be used to link the existing values to the new ones.
- In the Attribute Mapping, select the attributes to import and optionally modify their JSON keys.
- We also recommend filling in the Emails for Notifications field, where you can enter one or more email addresses to which error notifications will be sent.
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 |
Emails for Notifications | One or more email addresses to which emails with error conditions will be sent. | list of strings |
Users with API Access Permission | Users with the Robot role who are authorized to run the task. | list of users |
Basic Entity for Import | Specifies the entity for which the import should be performed. | selection |
Matching Attribute | Specifies the attribute used to match new values with existing ones. | selection |
Product Matching Attribute | Specifies the attribute used to match new product values with existing ones. | selection |
Attribute Mapping | The entity attribute in Quant that will be used to match items from the import. | complex type |
Create New Items | If enabled, the import will create new items for non-existent matching attribute IDs. | yes/no |
Ignore Deleted Items | If the import does not find an active item for a given ID, it searches among the deleted items by default. If it finds a deleted one, it will reactivate it. Enabling this option ignores deleted items instead of recovering them. | yes/no |
Delay in Seconds before Retrying | The number of seconds the client should wait before retrying the import in case of a long queue of requests to the server. | whole number |
Measure Unit | Unit of measure such as cm, mm, etc. | selection |
Date Format | Date entry format, eg 31.12.19 | selection |
Date and Time Format | Date and time format, e.g. 31.12.19 23:59:59 | selection |
List Item Separator | Character for splitting the items of the list of values. | character |
- Request
/v1/import/basic-entities/{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/json |
Header | Content-type: application/json |
Header | Authorization: Bearer <TOKEN> TOKEN is obtained via /authenticate (see Login). |
Method | POST |
The content of the request is an array of JSON objects containing the keys defined in the Attribute Mapping setting.
It is important that the request complies with JSON standards. Defined, for example, here. Please send numerical attribute values without quotation marks, see example.
Response
Key | Value |
Status | A string describing the final state of the import.
|
Warnings | Optional - included only if the ?debug parameter is in the URL and the import generated at least one warning. List of warning strings. |
Errors | Optional - included only if the import generated at least one error. List of error strings. |
Total Lines | Optional - is included only if the import did not end with the status "FAILURE" Number of records on input. |
Duplicated | Optional - is included only if the import did not end with the status "FAILURE" The number of records that were skipped because this item was already imported in the same request. |
Empty IDs | Optional - is included only if the import did not end with the status "FAILURE" The number of records that were skipped because no matching request ID was found for them. |
Ignored | By default, if the import cannot find a live item with specified ID, it searches the deleted items list instead. If a deleted item is found, it is restored. Enabling this option means that deleted items are ignored instead of being restored. |
Status Codes
Status | Value |
200 OK | Import successful with "SUCCESS" or "PARTIAL_SUCCESS" status. The response may contain warnings or minor errors. |
400 Bad Request | Incorrect task settings or incorrect request. |
401 Unauthorized | The authorization 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 error occurred during the import. |
503 Service Unavailable | The task is already running. Retry launching the task after count of seconds given in response header Retry-After. |
Latest Logs
In Quant, in addition to task settings, you can also view records of individual imports, including statistics, errors, and warnings.
We can view the details of a specific record by selecting it and clicking the Download Files button.
Request
curl -X POST --location "https://[YOUR_COMPANY].iquant.eu/v1/import/basic-entities/959977?debug" \
-H "Authorization: Bearer ywJqq25pXO6oaCPqgEAiTioBVwM8Ih2kOwzzd3eWK3R2oDSA5n" \-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-d "[ {"id":"CAT001","name":"Number 1","prodAt": ["External ID attribute 1","External ID attribute 2"]},
{"id":"CAT002","name":"Number 2","prodAt": "External ID attribute 1"},
{"id":"CAT003","name":"Number 3","prodAt": ["External ID attribute 1","External ID attribute 4","External ID attribute 5"]
"}]"
Response
{
"Status": "SUCCESS",
"Total Lines": 4,
"Duplicated": 0,
"Empty Ids": 1,
"Ignored": 0
}