Batch Calls
This page explains the process required to make a batch call to any endpoint.
Insert multiple products
POST
https://app.gem-books.com/api/RESOURCE_ENDPOINT
This endpoint allows you to create a batch call for an endpoint.
** Refer to endpoint for body details
Notes
Batch calls are supported for all endpoints that accept POST requests.
The input must be a JSON array of objects.
Each object in the array is processed independently.
The order of the results matches the order of the input objects.
If you send a single object (not an array), the API behaves as usual.
Headers
Authentication
string
Bearer token.
Content-Type
string
Should be application/json
.
Accept
string
Should be application/json
.
Request Body
Example of request body for an endpoint
code
string
Product code.
name_fr
string
Product French name.
name_en
string
Product English name.
{
"results": [
{
"result": "success",
"table_id": 22
},
{
"result": "success",
"table_id": 23
},
{
"result": "success",
"table_id": 24
}
],
"success": true
}
Body example
[
{
"code": "demo",
"name_fr": "Produit demo",
"name_en": "Demo Prodcut"
},
{
"code": "005",
"name_fr": "La Franchise",
"name_en": "Franchise"
},
{
"code": "006",
"name_fr": "Autre",
"name_en": "Other"
}
]
Update multiple products
PUT
https://app.gem-books.com/api/RESOURCE_ENDPOINT
This endpoint allows you to create a batch call for an endpoint.
** Refer to endpoint for body details
Notes
Batch calls are supported for all endpoints that accept POST requests.
The input must be a JSON array of objects and the body must contain the ID for each record.
Each object in the array is processed independently.
The order of the results matches the order of the input objects.
If you send a single object (not an array), the endpoint requires the :id: the API behaves as usual.
Headers
Authentication
string
Bearer token.
Content-Type
string
Should be application/json
.
Accept
string
Should be application/json
.
Request Body
Example of request body for an endpoint
id
int
ID of the record
code
string
Product code.
name_fr
string
Product French name.
name_en
string
Product English name.
{
"results": {
"success": [
{
"result": "success",
"table_id": 1
},
{
"result": "success",
"table_id": 2
},
{
"result": "success",
"table_id": 3
}
],
"error": [
{
"result":"error",
"error":"Update failed: Missing ID",
"data":{
"code": "006",
"name_fr": "Autre",
"name_en": "Other"
}
}
],
"success": true
}
Body example
[
{
"id": "1",
"code": "demo",
"name_fr": "Produit demo",
"name_en": "Demo Prodcut"
},
{
"id": "2",
"code": "005",
"name_fr": "La Franchise",
"name_en": "Franchise"
},
{
"code": "006",
"name_fr": "Autre",
"name_en": "Other"
}
]
Last updated