MY API returning 500 on the case of success instead of default 200, how can i handle it as success in retrofit 2.0.
Please help me .
Check your
response.errorBody()
if it contains the valid response you can convert it to JSON by using retrofit.responseBodyConverter
Related
I have a publish channel for which I've added a Json Mapping in order to send Json Format to the endpoint defined. The issue I'm facing is that when the response message is an error I cannot see the response body that contains the reason of the error. Anyone has any idea on how I can see the error description that can be found in the response body ?
I have created postman request to create and send envelop from template.
After sending it's returning this error
HTTP Error 400. The request URL is invalid.
Here is my postman request data
URL:https://demo.docusign.net/restapi/v2.1/accounts/xxxxxxxx/envelopes
Method: POST
Body:
{
"templateId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"templateRoles": [
{
"email":"test#gmail.com",
"name":"Tester",
"roleName":"signer3"
}
],
"status":"sent"
}
What can be the issue?
Here is the documentation link
I see nothing wrong above. You can see the full How to send an envelope with a template article.
Please confirm your accountId is correct where you have xxxxxxxx.
Please also see if you can use any URL for API calls.
A 400 error indicates there was something going on with the request. Can you turn on your API logging and see if you can reproduce the error? I agree with Inbar, I don't immediately see anything out of alignment. https://support.docusign.com/en/guides/ndse-user-guide-api-request-logging
If you could send the resulting log file along with a copy of your template to matt.king#docusign.com we can have a closer look.
I'm calling the Shipment/ConfirmShipment endpoint, and it's returning success in both .NET and Postman, but using Postman the shipment actually gets confirmed, while in .NET it doesn't.
In Postman, I'm doing a POST with the body containing JSON for the shipment number:
{"entity":{"ShipmentNbr":{"value":"022025"}}}
In .NET, I'm doing a HttpClient.PostAsync() to the same URL and with the same JSON as above. They both return success with a 202 Accepted response. However, as I mentioned, the Postman call confirms the shipment (Confirm = 1, Status = F), but in .NET, the POST doesn't actually confirm the shipment. Any ideas of what might be preventing it?
API v17.200.001
The status 202 Accepted might be a bit confusing but it does not mean that the action has completed succefully.
It only means that the execution request is valid and has been accepted by the system.
If you want to monitor the status of the Action itself you will need to use the address given in the header of the 202 Accepted response (the Location header)
So in my example that follows, you can see that my action has been accepted and that when I request the status of the operation I then get the 204 No Content which is the Success response.
Here I have requested the execution of the Confirm Shipment action and it has been accepted and I can see the url where I can fetch the status of the action
Here I have requested the status of the the action and can see the successful result
You can find more information here about the execution of an action through the REST API.
I recommend taking a look at the response section.
https://help-2017r2.acumatica.com/(W(1))/Main?ScreenId=ShowWiki&pageid=91bf9106-062a-47a8-be1f-b48517a54324
Here is more information about the 202 and the 204 http response:
https://httpstatuses.com/202
https://httpstatuses.com/204
I have been trying to do a put request via BambooHR api to add a time off request. But it gives 404 and the header gives "Invalid API call, Wrong method or URL"
I couldn't understand what's wrong with my code. Add a time off request from Bamboo HR documentation is /api/gateway.php/{company}/v1/employees/{employee id}/time_off/request/ Sample: PUT /api/gateway.php/test/v1/employees/1/time_off/request/
import requests
url = 'https://api.bamboohr.com/api/gateway.php/johnsnowlabs/v1/employees/96/time_off/requests/?status=requested'
response1= requests.put(url, auth=('68d4165c9262fcf2302745a6d791b23dsfsd4107','John11')
print(response1.status_code)
it gives 404 and when response1.headers then the error message says Invalid API call, Wrong method or URL
I tried different combination of inputs in url but none seems to be working. However, all the GET requests are working, it's only the PUT one is not working.
I have the following api endpoint defined:
#POST("api/ResetPassword")
Call<Envelope> resetPassword(#Query("email") String email);
which fails with the error message: "unexpected end of stream on okhttp3.address"
Is there a limitation preventing a query in a POST ?
Changed our endpoint from a POST to a GET and the call now works.
Did I miss the explanation of why #Query and POST don't work together with Retrofit/okhttp ?
Searching on the subject it doesn't appear to be prohibited in general though it might not be best practice.