question

matt avatar image
matt asked matt commented

REST API internal server error 500 with filter

Hi,

I get 500 errors, when using the filter "createdTime" and specifying a longer time period for the payments route. The request works when turning off the filter completely or when specifying a short time period (a year or so works)

Request:

https://api.clover.com/v3/merchants/C1B31MQ6CTAKC/payments?access_token=XXX&expand=tender&expand=cardTransaction&limit=1000&offset=0&filter=createdTime>=1302114988000

Access token is in separate moderator's post


REST API
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

matt avatar image
matt answered

the error has disappeared - still Clover's API should not return 500s - probably overwhelmed or whatever...

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered matt commented

This can happen for queries that are not constrained enough. Merchants can have a lot of orders, so querying for large time periods is problematic. Please limit your queries to avoid these issues.

5 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

matt avatar image matt commented ·

Well...then it's still not good, because there should be a useful response. In addition, it worked WITHOUT filter, but it did not work WITH filter. Since the response is anyway limited to 1000 datasets, IMHO there should not be 500 errors.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ matt commented ·

I agree, but it is also not good to do open or broad queries. Just because the response is limited does not mean the query is performant.

1 Like 1 ·
matt avatar image matt David Marginian ♦♦ commented ·

Hi David, I did again some testing as the 500 errors are a problem for my app in production. I made a series of requests with the created_at filter and the requests are limited to a period of 30 days, which shouldn't be a problem in terms of results. The log of the requests shows that timestamps below unix time 1500000000000 returned 500 errors. I made three rounds of the same test series. 2 times the requests below this timestamp returned 500, in the other round it returned 200. All requests above this number returned 200. So maybe it is a hint on the issue on Clover's side. Logs are posted in separate moderator's post due to token.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ matt commented ·

I tried with my test merchant in production and didn't have the issue. From what I can tell it appears this happens when there are no payments in the time period and the time period is quite large. Can you confirm that this merchant actually has orders within this time-frame? I have written up an issue on our end to have the payments team look into this.

0 Likes 0 ·
matt avatar image matt David Marginian ♦♦ commented ·

I tried again with newer timestamps and the 500 appears also here, it appears only when using the createdTime filter, as soon as I turn off the 2 filters everything works fine. The time frame is just a month.

Used request:

https://api.clover.com/v3/merchants/C1B31MQ6CTAKC/payments?access_token=xxx&expand=tender&expand=cardTransaction&limit=1000&offset=0&filter=createdTime>=1561979130000&filter=createdTime<1564743930000

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community