Example:
{
"id": 42,
"request_id": "3ca34bed-13e3-436c-a966-2dce39b88e94",
"entity": "Product",
"status": "complete",
"percent_completed": 1,
"operation": "upsert",
"created_at": "2016-05-31T10:18:28.752+10:00",
"updated_at": "2016-05-31T10:18:30.892+10:00",
"created_by": "test@fusionfactory.com",
"error_count": 0,
"result": "Success"
}
| Code | Description |
|---|---|
| 401 | Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource. |
| 403 | Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource. |
| 404 | Not Found. The requested resource could not be found. |
| 422 | Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors. |
| 500 | Internal Server Error. An unexpected condition was encountered. |
request:
{
"job": {
"entity": "Product",
"operation": "upsert",
"options": {
"object_in_response": false
},
"data": [
{
"_request_data_id": "7y3k9iuye6",
"product_type": "product",
"code": "12345",
"status": "active",
"name": "Product 12345",
"attribute_set": "Automotive",
}
]
}
}
response:
{
"id": 429,
"request_id": "2e2b36a6-e6f7-42ae-a388-e53bfa2626be",
"entity": "Product",
"format": "json",
"status": "ready_to_process",
"percent_completed": 0,
"file_name": null,
"operation": "insert",
"created_at": "2016-05-30T14:55:57.316+10:00",
"updated_at": "2016-05-30T14:55:57.429+10:00",
"sidekiq_job_id": "2f8717aec0a079b0afcc13fc",
"created_by": "test@fusionfactory.com",
"error_count": 0,
"import_method": "api",
"file_upload_id": null
}
Sample: Reset price items in the specified price book for the product. (the old price items will be removed)
{
"job": {
"entity": "PriceItem",
"operation": "reset",
"options": {
"object_in_response": false
},
"data": [
{
"amount": 12,
"from": "2016-07-05T09:00:00.000+10:00",
"to": "2016-07-08T09:00:00.000+10:00",
"product_id": 6,
"price_book_id": 1
}
]
}
}
Or
{
"job": {
"entity": "PriceBook",
"operation": "reset",
"options": {
"object_in_response": false
},
"data": [
{
"id": 1,
"products": [
{
"id": 28,
"price_items": [
{
"amount": 14,
"from": "2016-07-05T09:00:00.000+10:00",
"to": "2016-07-08T09:00:00.000+10:00"
},
{
"amount": 1
}
]
}
]
}
]
}
}
Or we can use PriceBook Name and product code instead of IDs.
{
"job": {
"entity": "PriceBook",
"operation": "reset",
"options": {
"object_in_response": false
},
"data": [
{
"name": "default",
"products": [
{
"code": "product_1",
"price_items": [
{
"amount": 14,
"from": "2016-07-05T09:00:00.000+10:00",
"to": "2016-07-08T09:00:00.000+10:00"
},
{
"amount": 1
}
]
}
]
}
]
}
}
Sample:
Delete price items by product and price book. operation=purge is only applicable for PriceItem at this stage.
All price items for the given product and price book will be removed.
{
"job": {
"entity": "PriceItem",
"operation": "purge",
"options": {
"object_in_response": false
},
"data": [
{
"product_code": "1000-INK-SIL",
"price_book_name": "AUD Sale"
},
{
"product_id": 1367,
"price_book_id": 1
}
]
}
}
Sample: Reset product variation for the child product.
{
"job": {
"entity": "ProductVariation",
"operation": "reset",
"options": {
"object_in_response": false
},
"data": [
{
"parent_id": 8,
"child_id": 7
}
]
}
}
Or
{
"job": {
"entity": "ProductVariation",
"operation": "reset",
"options": {
"object_in_response": false
},
"data": [
{
"parent_product_code": "Product-ABC",
"child_product_code": "Product-ABC-variation-1"
}
]
}
}
| Param name | Description |
|---|---|
|
job required |
Validations:
|
|
job[entity] required |
Validations:
|
|
job[operation] required |
Operation for the job Validations:
|
|
job[options] optional , nil allowed |
Options for the job Validations:
|
|
job[options][object_in_response] optional , nil allowed |
Default: true. Set this to false to not include object details in the job response. Validations:
|
|
job[data] required |
Array of hash data. The scheme of the data is the same as the corresponding REST API. _request_data_id (optional) can be included to associate response with the entity data. Validations:
|
|
lang optional |
The language code to which translatable fields are saved against. Validations:
|
| Code | Description |
|---|---|
| 401 | Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource. |
| 403 | Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource. |
| 404 | Not Found. The requested resource could not be found. |
| 422 | Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors. |
| 500 | Internal Server Error. An unexpected condition was encountered. |
response:
{
"page": 1,
"per_page": 50,
"total_pages": 1,
"total_entries": 1,
"entries": [
{
"id": 429,
"request_id": "2e2b36a6-e6f7-42ae-a388-e53bfa2626be",
"entity": "Category",
"status": "complete",
"percent_completed": 1,
"operation": "insert",
"created_at": "2016-05-30T14:55:57.316+10:00",
"updated_at": "2016-05-30T14:55:58.671+10:00",
"created_by": "test@fusionfactory.com",
"error_count": 0,
"result": "Success"
}
]
}
status:
request_received - job request received but not yet scheduled to run
fail_to_receive - the job payload/format is not acceptable
ready_to_process - job is scheduled to process
processing - job is being processed
fail_to_process - exception happened during processing the job
canceled - job aborted
complete - job processing is completed
result:
Success - job completed without error
Failure - job completed with error or the job status is fail_to_receive or fail_to_process
Pending - result not yet available (job not completed)
| Param name | Description |
|---|---|
|
per_page optional |
Number of objects in one response. Default is 50 Validations:
|
|
page optional |
Page number. Default is 1 Validations:
|
|
id optional |
ID of the job Validations:
|
|
request_id optional |
Request ID of the job Validations:
|
|
created_by optional |
The submitter of the job Validations:
|
|
created_time_from optional |
ISO_8601 format 2016-05-30T05:13:26Z Validations:
|
|
created_time_to optional |
ISO_8601 format 2016-05-30T05:13:26Z Validations:
|
|
updated_time_from optional |
ISO_8601 format 2016-05-30T05:13:26Z Validations:
|
|
updated_time_to optional |
ISO_8601 format 2016-05-30T05:13:26Z Validations:
|
| Code | Description |
|---|---|
| 401 | Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource. |
| 403 | Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource. |
| 404 | Not Found. The requested resource could not be found. |
| 422 | Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors. |
| 500 | Internal Server Error. An unexpected condition was encountered. |
response:
{
"id": 429,
"request_id": "2e2b36a6-e6f7-42ae-a388-e53bfa2626be",
"entity": "Category",
"status": "complete",
"percent_completed": 1,
"operation": "insert",
"created_at": "2016-05-30T14:55:57.316+10:00",
"updated_at": "2016-05-30T14:55:58.671+10:00",
"created_by": "test@fusionfactory.com",
"error_count": 0,
"result": "Success",
"processing_details": [
{
"errors": [],
"id": 327,
"category": {
...
}
},
{
"_request_data_id": "7y3k9iuye6",
"errors": [],
"id": 330,
"category": {
...
}
},
{
"errors": [],
"id": 333,
"category": {
...
}
}
]
}
processing_details:
id - the object ID generated by CommerceConnect. Save this ID in the client and use it to refer to the object in other APIs.
errors - errors during processing the job
_request_data_id - the same value passed in the payload. Use this value to identify the individual element if needed (for example, in the case of failing to create object)
%entity% - the hash version of the object. This is similar to the response from GET /api/v2/:entity . If this is not needed, we suggest to set job[options][object_in_response] to false when posting the job.
| Param name | Description |
|---|---|
|
id optional |
Job ID Validations:
|