question

jonnolen avatar image
jonnolen asked jonnolen commented

adding two filter params to an api call causes zero results, if this isn't a bug, how do i retrieve things in a date range

if i make the request:

https://api.clover.com:443/v3/merchants/{merchantId}/payments?filter=clientCreatedTime>=1488344400

Then I get 100 results back (in the api documentation portal and via code)

if I add a <= filter on clientCreatedTime to on return results between 2017-03-01T00:00:00 and 2017-03-02T23:59:59 like this:

https://api.clover.com:443/v3/merchants/{merchantId}/payments?filter=clientCreatedTime>=1488344400&filter=clientCreatedTime<=1488517199

I get zero results (api documentation or via code), and when i check the network console in chrome I'm actually getting the following error back:

HTTP 400, body: {"message":"Cannot parse '1488344400&filter=clientCreatedTime<=1488517199' as timestamp for field clientCreatedTime"}

update: I had it working with milliseconds

It looks like it's an issue with using seconds instead of milliseconds... however, I'd argue that the parsing is incorrect because, while clover may not even have been a company at 1488344400 seconds past the unix epoch, that query still works and it shouldn't fail to parse because that number is too small if i add another filter clause after that. for example:

https://api.clover.com:443/v3/merchan...

also fails with this message:

{"message":"Cannot parse '1488344400&filter=amount>100' as timestamp for field clientCreatedTime"}

Which I feel is a bug at the very least.


update 2: It is no longer working with milliseconds in the api documentation (though it was at one point)

https://api.clover.com:443/v3/merchants/{merchantId}/payments?filter=clientCreatedTime>1489982400000&filter=clientCreatedTime<1490068799999

now fails with:

{"message":"Cannot parse '1489982400000&filter=clientCreatedTime<1490068799999' as timestamp for field clientCreatedTime"}
3 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.

jonnolen avatar image jonnolen commented ·

made follow up comment an answer.

0 Likes 0 ·
sam avatar image sam commented ·

ttps://api.clover.com:443/v3/merchants/{merchantId}/payments?filter=clientCreatedTime>1489982400000&filter=clientCreatedTime<1490068799999 seems to be working for me using Postman. Could you confirm this is still an issue for you?

0 Likes 0 ·
jonnolen avatar image jonnolen commented ·

I just tested it in Paw, and it worked (even with the short dates). it appear to be only an issue with the api documentation integration... sorry for the thrashing.

0 Likes 0 ·

1 Answer

jonnolen avatar image
jonnolen answered

It looks like it's an issue with using seconds instead of milliseconds... however, I'd argue that the parsing is incorrect because, while clover may not even have been a company at 1488344400 seconds past the unix epoch, that query still works and it shouldn't fail to parse because that number is too small if i add another filter clause after that. for example:

https://api.clover.com:443/v3/merchan...

also fails with this message:

{"message":"Cannot parse '1488344400&filter=amount>100' as timestamp for field clientCreatedTime"}

Which I feel is a bug at the very least.

10 |2000

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