| 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:
|