question

mlyon avatar image
mlyon asked David Marginian Deactivated answered

"created" parameter on /v1/charges endpoint - not working?

I'm attempting to filter the results from the /v1/charges endpoint based on the created timestamp. The API reference shows an object parameter with the name "created", which can include greater-than/less-than values. The documentation doesn't make it clear how these values are supposed to be formatted (in seconds? milliseconds?), however, it doesn't seem to matter what I put in for those parameters, they don't have any effect. I can put a "gt" value in that is 1 less than the "lt" value, which shouldn't return anything, and it still returns all the records. I've tried this using the online REST API Reference form, as well as with my own code, and neither work.

I did notice that when using the API Reference, it sets the url parameters like "created[gt]=1585699200&created[lt]=1586044800" (urlencoded, of course). However, on the "paginating requests" page of the ecommerce API tutorials, it shows the example with the parameter json-encoded like "created={"gt":1585699200,"lt":1586044800}". Regardless, I've tried both and neither work.

Any advice on how these parameters are supposed to function would be appreciated.

REST APISandboxe-commerce 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.

David Marginian avatar image
David Marginian Deactivated answered timg commented

Update:

This is a documentation issue, currently, we support searching via date/time:

/v1/charges?created.gt=2021-01-22%2011:12:14

I will have the documentation team fix our docs.

Original Post:

Something doesn't seem right here. I will let the ecomm team know. Alternatively (or in the meantime) you could use the v3/orders endpoint - https://docs.clover.com/reference#ordergetorders-2, and, https://docs.clover.com/docs/applying-filters.

2 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.

Ok, that appears to be working, thanks.

0 Likes 0 ·

This is solution is only working for the date portion. For the portion after the percent sign I see it doing something in the API and is valid, but I can't figure out the formats meaning. For example what does 2011:12:14 represent?

0 Likes 0 ·
David Marginian avatar image
David Marginian Deactivated answered

%20 is an url encoded space, 11 is hours, 12 is minutes, 14 is seconds.

10 |2000

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

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