cancel
Showing results for 
Search instead for 
Did you mean: 

Reduce number of API calls

SOLVED

Reduce number of API calls

I am currently implementing an application that manages categories, products, variants, attributes in Magento based on the resources from our PIM systen.To do so it utilizes the Magento 2.3 API.

We run about 30 stores in different languages and our products (configurable products) can have up to 50 variants. My current implementation basically to calls the Magento API 30*50 = 1.500 times to update just a single product. 

 

Is this the correct way to upload such products or is there a better solution? I know I could use bulk api but I need imediate response (error or confirmation) on the result of task.

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Reduce number of API calls

Re: Reduce number of API calls

@Damian Culotta Thanks. If I got you right, sending 900 request is the correct approach, however I could bundle them via bulk API. These endpoints offer a great opportunity to improve performence. However I tried to avoid these endpoints due to their asynchronous status response.

 

 

 

View solution in original post

3 REPLIES 3

Re: Reduce number of API calls

Hi @valentinsa60763,

 

Not sure if this could help but since you're using 2.3.1, did you read about these topics?

 

 

Re: Reduce number of API calls

@Damian Culotta Thanks. If I got you right, sending 900 request is the correct approach, however I could bundle them via bulk API. These endpoints offer a great opportunity to improve performence. However I tried to avoid these endpoints due to their asynchronous status response.

 

 

 

Re: Reduce number of API calls

Uploading a configurable product with 30 variants to 30 shops now results in 930 calls. The problem is now that an update of a simple product usually takes more then 1 second, so updating a single configurable product leads to an update time of more then 15 minutes.

 

The possibility to run some updates in parallel would result in a signifikant optimization. However the API returns "The stock item was unable to be saved. Please try again." whenever I run more then one request in parallel. As I use the same stock item in all 30 stores, I hoped I could avoid this massage by leaving stock_item empty or completely removing it from the update payload for all != 'all' or != 'default' stores. Unfortunately this does not change anything. Magento still seems to update a stock item, eventhough nothing has to be updated at all.

 

Is it possible that disabling Magentos Inventory Management might solve this issue, thus making it possible to upate products concurrently?