My Products
Help
ExactGebruiker
CONTRIBUTOR ***

Encoutering errors in truncated form from API response

by ExactGebruiker

Hi,

 

When something goes wrong in our API service call to Visma, we get a truncated error. However, when making the same call from the Swagger page, we get the full error. It would be really useful if we could somehow also get the full error to our own app with a header to indicate that, or just by default. We can retrieve entire documents but are somehow not allowed to retrieve a full error when doing a request. There is also no id except the ipp-request-id to maybe fetch what went wrong, which us users can not use.

 

Can you help us retrieve full errors when something fails in our API call?

 

Thanks ahead.

5 REPLIES 5
Accepted solution
ExactGebruiker
CONTRIBUTOR ***

by ExactGebruiker

Hey there, the cause has been found, it appears to be a problem on our end that would've come to light had we just thrown the CURL call through. If others are finding this in PHP using Guzzle, then they need to try catch capture the BadResponseException around the ->send() and recreate it as Guzzle cuts it off in creating the error. The response body still holds the original full sized error.
https://github.com/guzzle/psr7/blob/2.5/src/Message.php#L75

by Magnus Johnsen

Could you please send us the ipp-request-id and the error message you received?

We'll check if it get's truncated on our end. 

Thank you. 

ExactGebruiker
CONTRIBUTOR ***

Hi,

 

Any updates on this?

Hi,

We're still looking into this, do you happen to have any more examples of truncated errors, if so please send us the ipp-request-id and we'll keep investigating.

Thank you. 

ExactGebruiker
CONTRIBUTOR ***

Hi,

 

038e874c-8aa0-4123-b8fe-2519d9617394
This gets truncated as shown below
Client error: `POST https://integration.visma.net/API/controller/api/v1/supplierInvoice` resulted in a `400 Bad Request` response:
{"message":"Error creating supplierInvoice. {\"1\":{\"SubID\":\"An error in processing of field Subaccount: Error: Koste (truncated...)
Whereas
3b787520-066d-42bc-abc8-be4cc1409da5
This one was done in Swagger and does not get truncated as shown below
{
  "message": "Error creating supplierInvoice. {\"1\":{\"SubID\":\"An error in processing of field Subaccount: Error: Kostenplaats of Subaccount do not exist.\"},\"2\":{\"SubID\":\"An error in processing of field Subaccount: Error: Kostenplaats of Subaccount do not exist.\"},\"3\":{\"SubID\":\"An error in processing of field Subaccount: Error: Kostenplaats of Subaccount do not exist.\"}}"
}
But there are a lot more errors that just get truncated, anything big just gets cut off entirely.