question

matt avatar image
matt asked matt commented

Strange results with export API

I have made use of the export API already some weeks ago. Now that I made some more tests I noticed that my initial request returns elements that have status "DONE", although they are not within the time frame given in the JSON payload of the request. These elements seem to be old results and don't seem to be related to the current request. Is there something wrong with my request or a bug?

https://apisandbox.dev.clover.com/v3/merchants/ABCDEFGH/exports/?access_token=abdecfgheh&return_null_fields=true

# body:
{
  "type": "PAYMENTS",
  "startTime": 1577838602000,
  "endTime": 1580344202000
}

# result, only first entry
{ "elements": [ 
{ "id": "ZPMF4KVZN4BVW", 
"type": "PAYMENTS", 
"status": "DONE", 
"statusDescription": null, 
"percentComplete": 100, 
"availableUntil": 1585173090000, 
"startTime": 1530653798000, 
"endTime": 1533245798000, 
"createdTime": 1585086683000, 
"modifiedTime": 1585086721000, 
"exportUrls": { 
"elements": [ 
{ 
"url": "https://storage.googleapis.com/...", 
"export": { "id": "ZPMF4KVZN4BVW" } 
} 
] }, 
"merchantRef": { "id": "ABCEDEF" }, 
"pgpPublicKey": null },

[...]


Also I have given PAYMENTS, but I also get ORDERS as results. I will post the real request as a private comment to make it testable.

In addition it would be interesting if there is a possibility to expand results like with REST API? For example within payments "tender" is only included with an id. If I have to request the tender for each payment separately with REST API it would somehow defeat the purpose of the export API.

REST APISandbox
10 |2000

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

1 Answer

·
David Marginian avatar image
David Marginian Deactivated answered matt commented

I tried the same request you are making and got back a single payment within the time-frame. Are you sure you are doing a POST?

10 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 ·

Oops, you are absolutely right! It was misleading that GET also delivers results. What about my second question...Would I have to refill tender information using REST API calls or is there any option with export API like expanding?

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

https://github.com/clover/export-api-examples

See the README here, once you create the export (via POST):

Once the call has been made, you will occasionally do a GET call to /v3/merchants/{merchant_Id}/exports/{export_Id} to check the status and percent complete.

A brief look at the server code and It looks like the GET endpoint allows order expansions.

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

Sorry to bother you again, but I guess you meant adding the expand to the first request (POST), since the second (GET) already contains the download link. So I tried with the first POST request using the expand=tender for PAYMENTS (I am looking for tender and cardTransaction), so I tried the following

https://apisandbox.dev.clover.com/v3/merchants/ABC/exports?expand=tender&access_token=abcedefgh

There is no error message, but also the result is not different than without the expand. I don't have any idea for a different syntax.

0 Likes 0 ·
Show more comments

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