Hi Rahul,
Can you provide an example REST request that is timing out?
Note that when you are making API requests, you can use the page
and per_page
options to limit your number of results (see https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products for an example). You can then make multiple requests to get data. This should allow you to get all the data you need, without timeouts.
The REST API is limited by PHP’s execution time limit (https://www.php.net/manual/en/function.set-time-limit.php) — so a large request cannot be handled. You could attempt to increase this limit if your host gives you access, but it would be better to break the requests up.
Best,
Justin
dougaitken
(@dougaitken)
Automattic Happiness Engineer
Hey @rahul-yadav
We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.
Thanks,
Ben
(@bencalder)
I had this issue around the same time as a few other people.
After a bit of a process of elimination and disabling all of my plugins as above I found that 2 discount plugins (1 being Dynamic Discounts and the other being Varteck pricing both break the REST API after the WooCommerce update around the middle of April.
I have left them both disabled for the moment and everything is working ok.
dougaitken
(@dougaitken)
Automattic Happiness Engineer
Hey @bencalder
I appreciate you dropping the details in this thread for others to find – have you reached out to the developers of those extensions to see if they’re working on a fix?
Thanks,
Hello @jshreve ,
Sorry for the late reply!!
Is there any another way to fix the 504 gateway error instead of using per_page request while using WooCommerce Rest API.
Thanks,