- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Hi, I'm pulling payments using the List Payments API, documented here, and puzzled that pagination appears to not be working for me when I use the "me" location_id. That API doc says "If you specify me
, this endpoint returns payments aggregated from all of the business' locations" and also that "This endpoint might paginate its results", so I believe pagination is supposed to work in this case.
Test case below using 2 curl commands, the sole difference between the two is that one goes to /v1/ABC/payments and the other hits the /v1/me/payments endpoint. Both return proper data, but one returns a "Link" HTTP header as expected for pagination and one does not. Subbing in XXX for my Bearer token and ABC for one of my location_ids.
EXPECTED CASE
curl -v -G -H "Authorization: Bearer XXX" https://connect.squareup.com/v1/ABC/payments --data-urlencode 'limit=200' --data-urlencode 'begin_time=2016-07-20T06:00:00-04:00' --data-urlencode 'end_time=2016-07-21T06:00:00-04:00' | python -mjson.tool | grep payment_url | wc -l > GET /v1/ABC/payments?limit=200&begin_time=2016-07-20T06%3A00%3A00-04%3A00&end_time=2016-07-21T06%3A00%3A00-04%3A00 HTTP/1.1 > User-Agent: curl/7.26.0 > Host: connect.squareup.com > Accept: */* > Authorization: Bearer XXX > < HTTP/1.1 200 OK < Content-Type: application/json < Link: <https://connect.squareup.com/v1/ABC/payments?batch_token=5bYwycCRNdXkGO3kQqE6Zy1wI8jACMOU80G5qAjFzpgvyTX1E4pTYXmyaCmmGaN02owBEmAeFdkn67TvlD6uZzA5OHTo8yBj7tYnV5VLaE&begin_time=2016-07-20T10%3A00%3A00Z&end_time=2016-07-21T10%3A00%3A00Z&limit=200>;rel='next' < Vary: Origin, Accept-Encoding < X-Content-Type-Options: nosniff < X-Download-Options: noopen < X-Frame-Options: SAMEORIGIN < X-Permitted-Cross-Domain-Policies: none < X-Xss-Protection: 1; mode=block < Date: Sat, 01 Apr 2017 21:33:03 GMT < Transfer-Encoding: chunked < Keep-Alive: timeout=60 < Strict-Transport-Security: max-age=631152000 < { [data not shown] 100 428k 0 428k 0 0 241k 0 --:--:-- 0:00:01 --:--:-- 259k * Connection #0 to host connect.squareup.com left intact * Closing connection #0 * SSLv3, TLS alert, Client hello (1): } [data not shown] 200
UNEXPECTED CASE
curl -v -G -H "Authorization: Bearer XXX" https://connect.squareup.com/v1/me/payments --data-urlencode 'limit=200' --data-urlencode 'begin_time=2016-07-20T06:00:00-04:00' --data-urlencode 'end_time=2016-07-21T06:00:00-04:00' | python -mjson.tool | grep payment_url | wc -l > GET /v1/me/payments?limit=200&begin_time=2016-07-20T06%3A00%3A00-04%3A00&end_time=2016-07-21T06%3A00%3A00-04%3A00 HTTP/1.1 > User-Agent: curl/7.26.0 > Host: connect.squareup.com > Accept: */* > Authorization: Bearer XXX > < HTTP/1.1 200 OK < Content-Type: application/json < Vary: Origin, Accept-Encoding < X-Content-Type-Options: nosniff < X-Download-Options: noopen < X-Frame-Options: SAMEORIGIN < X-Permitted-Cross-Domain-Policies: none < X-Xss-Protection: 1; mode=block < Date: Sat, 01 Apr 2017 21:30:03 GMT < Transfer-Encoding: chunked < Keep-Alive: timeout=60 < Strict-Transport-Security: max-age=631152000 < { [data not shown] 100 437k 0 437k 0 0 357k 0 --:--:-- 0:00:01 --:--:-- 367k * Connection #0 to host connect.squareup.com left intact * Closing connection #0 * SSLv3, TLS alert, Client hello (1): } [data not shown] 200
SUMMARY
As you can see above, I'm using wc to count the result data and both endpoints correctly return 200 transactions (as 200 is the set limit), however only the /v1/ABC/payments endpoint properly returns the "Link" HTTP header indicating paginated results. The /v1/me/payments endpoint is not returning a Link header for some reason I can't figure out.
Is this a known issue or expected behavior? The only other forum post I see on api pagination seems unrelated / user error.
Let me know if I can send over any additional info for debug.
cheers,
dan
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Sorry for the delay. Our documentation incorrectly suggests that you can use the /me endopints for payments, but really they should only be used for employees. Please use the /location versions of the endpoints to get all of your payment history. We will be updating our documation soon.
Thank you for bringing this issue to our attention!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Thank you for your well written question! We are looking into this now.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Any update on this from Square engineers @tristansokol, or should I contact support directly?
It's not terribly comforting for me to see an API that provides financial information producing incorrect results. Still not working for me.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Sorry for the delay. Our documentation incorrectly suggests that you can use the /me endopints for payments, but really they should only be used for employees. Please use the /location versions of the endpoints to get all of your payment history. We will be updating our documation soon.
Thank you for bringing this issue to our attention!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report