My Products
Help
Magnus Vadla
PARTNER

How to figure out if a background action failed?

by Magnus Vadla

My app is trying to account for purchaseReceipt release operation sometimes failing.

I have a case where I get a 200 both in the background webhook, and when checking the stateLocation, however the receipt status is still balanced. Is this working as intended?

 

 

Original request:

POST https://integration.visma.net/API/controller/api/v1/PurchaseReceipt/000451/action/release

response body:

{
  "id": "8b6bad6c-11d7-46ed-b79f-17fc63260765",
}
 
received webhook:
{
  "id": "8b6bad6c-11d7-46ed-b79f-17fc63260765",
  "statusCode": 200,
}
 
stateLocation call:
response body:
{
  "id": "8b6bad6c-11d7-46ed-b79f-17fc63260765",
  "status": "Finished",
  "statusCode": 200,
  "receivedUtc": "2022-11-14T11:30:11.726+01:00",
  "startedUtc": "2022-11-14T11:30:11.773+01:00",
  "finishedUtc": "2022-11-14T11:30:13.379+01:00",
  "webhookAddress": "*sanitized*",
  "hasResponseContent": true,
  "hasRequestContent": false,
}
 
receipt 000451 is still Balanced.
 

 

3 REPLIES 3
Magnus Vadla
PARTNER

by Magnus Vadla

Understood. I will add a Get call to check the status when I receive the operation completed notification.

Out of curiosity, why does the stateLocation sometimes show a 400?

Yıldırım
VISMA

by Yıldırım

Hi Magnus, it can be related to that hasResponseContent:False depending on the operation.

e.g.
StateLocation.jpg

Accepted solution
Yıldırım
VISMA

by Yıldırım (Updated ‎15-11-2022 10:14 by Yıldırım VISMA )

Hello Magnus, 

 

If the endpoint today is asynchronous
meaning that if it is immediately returning a “202-Accepted” HTTP response and starts the actual job in the background, such as “Action” based operations. (Endpoint URL: …/action/…),  

 

  • Currently,  the new "Background API" system is also unable to receive the state of the document when the action based request invoked.
  • Therefore, we’re unable to determine whether the “action” based process succeeded or the state of the document changed without making an additional GET request to see the actual status of the document.

However, this topic is already in our development plan. (Endpoint logic should be "synchronous" so that, waiting for the actual job to be done, to inform the client accordingly.)