Does Zoho have any plans in the foreseeable future to add GraphQL to the API so that we can have some flexibility with our API requests?
GraphQL would allow us to get the data we wanted, and would drastically minimise API requests, reducing server loads on both sides.
With the API requests minute limit being reduced recently from 100 to 30 calls per minute, it is making it very difficult to do an inventory synchronise between platforms without lots of backend waiting so that we don't get locked out of the API.
My reasoning for this is just to get the required item information for a single SKU takes 4 rest api calls. (1 less if using pagination for bulk get)
1) https://www.zohoapis.com/inventory/v1/items?sku=sku1 (Gets minimal info)
2) https://www.zohoapis.com/inventory/v1/items/1234567890 (Gets more info)
3) https://www.zohoapis.com/inventory/v1/itemdetails?item_ids=1234567890 (Gets more required info)
4) https://www.zohoapis.com/inventory/v1/items/items/images/1234567890
For a full synchronise of items to another platform, the 30 api calls is blown out before we even get the required information back.
1) items = https://www.zohoapis.com/inventory/v1/items?per_page=200,page=1 (Gets minimal info of all items using pagination)
foreach (items as item) {
2) https://www.zohoapis.com/inventory/v1/items/1234567890 (Gets more info)
3) https://www.zohoapis.com/inventory/v1/itemdetails?item_ids=1234567890 (Gets more required info)
4) https://www.zohoapis.com/inventory/v1/items/items/images/1234567890
*** API LOCK OUT BY MINUTE LIMIT BEFORE GETTING THE 10TH ITEM ***
wait(60) # setup a wait function for 60 seconds so we don't go over the 30 calls.
}
To synchronise 1,000 items to another platform will take 112 minutes via Zoho API. Nearly 2 hours, WTF...
GraphQL would be 1 API call for 200 items with ***ALL*** the data we require.
{
items {
item {
details {
sku
price
brand
manufacturer
weight
custom_fields {
customfield_id
api_name
value
}
whatever_other_fields_required
}
images {
image_name
}
}
}
}
This would also be the case for creating, updating, deleting resources.
With GraphQL using pagination of 200 per page, we could get 6,000 resources within the 30 api calls in the minute. Much more than the dismal 9 using rest api.
GraphQL is very powerful query language, hence why all the major players use it such as Facebook, Paypal etc.
I'd like to hear other programmers thoughts on this too.