• Resolved Rahul Yadav

    (@rahul-yadav)


    Hello,

    Can anyone help to figure out the 504 gateway timeout issue in my application while using WooCommerce Rest API? I am using Woo rest API in one of my application, where I will fetch the orders/products/customers data and show in my application, but unfortunately, if the record is a large amount then the request API gives me this error. This is not a store issue or not an internet connection and server issue, but the rest API can’t handle a large amount of data. So please help me what I can do to resolve it in a single request or any other way?

    Thanks,

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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,

    Thread Starter Rahul Yadav

    (@rahul-yadav)

    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,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘While use Woo Rest API getting 504 gateway timeout’ is closed to new replies.