I am working on an API Specification in Swagger which is behaving in an unknown manner.
Request URL: https://api-de.test.com.au/v2/poc/quotes/12345/tc
Request Type : GET
Here 12345 is the id that needs to be passed to fetch info
If ID is blank : https://api-de.test.com.au/v2/poc/quotes//tc
I am not getting 404 Resource Not Found
Wherein, I have created another API that has a similar type of URL but the API is of type POST, there the status code is returning 404.
My question is why a similar type of URL is getting me a different status code for GET and POST.
Related
I tried to post method in ajax request Method Not Allowed in js and give me Status Code 4
enter image description here
You are trying to access the incorrect url for your site, as stated in the log message your url is https://morning-crag-28829.herokuapp.com
I am trying to access the status_code of a valid url, however a 404 is returned although the link exists. Here is the line of code that returns me a 404:
print(requests.get("https://www.moh.gov.sg/docs/librariesprovider5/local-situation-report/situation-report-21-jul-2020.pdf").status_code)
This is the link of the PDF that i am trying to access: https://www.moh.gov.sg/docs/librariesprovider5/local-situation-report/situation-report-21-jul-2020.pdf
Is anyone able to explain to me why i get a 404 from trying to access a valid url? Thank You.
It is giving status code 404 not found because you didn't pass the mandatory header Accept while requesting. Accept request-header field is to specify certain media types which are acceptable for the response.
print(requests.get("https://www.moh.gov.sg/docs/librariesprovider5/local-situation-report/situation-report-21-jul-2020.pdf",
headers={"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"},
verify = False))
Try the above code you will get status code 200
Added an image of google developer network section for more clarity.
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 try to get information about items using Amazon Product API (for example http://webservices.amazon.com/scratchpad/index.html# ).
There is no problem for items from amazon.com(US), but for some items from amazon.fr, amazon.de API returns:
Error! AWS.InvalidParameterValue HTTP Status 200: Success B01B8E8OP4
is not a valid value for ItemId. Please change this value and retry
your request.
But https://www.amazon.fr/Ravensburger-24011-Jeu-Educatif-Colorino/dp/B01B8E8OP4/ref=lp_10946356031_1_1?s=toys&ie=UTF8&qid=1515158225&sr=1-1 is present.
I have registration as associate at amazon.fr and use appropriate associate tag.
For amazon.de:
Error! AWS.InvalidParameterValue HTTP Status 200: Success B014FSAOYE
is not a valid value for ItemId. Please change this value and retry
your request.
but https://www.amazon.de/dp/B014FSAOYE/ref=sspa_dk_detail_5?psc=1
What do you think about it?
It's because different API endpoins for each location https://docs.aws.amazon.com/AWSECommerceService/latest/DG/Locales.html
And enpoind URL for request must be:
https://webservices.amazon.fr/onca/xml