Request failed (HTTP/1.1 400 Bad Request) when polling website for Json

2273
5
10-04-2019 07:59 AM
PatriciaBongaerts
New Contributor II

I keep getting a '400 Bad Request' error when polling a website for json and I can't find the reason why.

The service is secured but in the logfiles I can see the authentication succeeded.

I get a correct json when I call the API in the browser on the server where Geoevent is installed.

I don't know where to look next.

Patricia

0 Kudos
5 Replies
Stefan_Jung
Esri Contributor

Hi Patricia Bongaerts‌,

if i understand you correct you don't have any problems connecting to the server. So there is no issue with http/https or the authentication itself.

You could set the Log Level for the class: com.esri.ges.httpclient.Http to DEBUG and see if you get some more information that help to identify the problem. 

Best 

Stefan

0 Kudos
PatriciaBongaerts
New Contributor II

Hi Stefan,

Thank you for your response. 

I don't get any more information than this:

Executing following request: GET http://hageventaccpt.haven.antwerpen.local:6080/arcgis/help/nl/cxhelp.xml HTTP/1.1 8 okt. 2019 09:52:32 DEBUG
https://api-internal-accpt.portofantwerp.com/ship-position/shippositions?min_lat=51.16221&max_lat=51.36609&min_lng=4.13116&max_lng=4.54726: Request failed (HTTP/1.1 400 Bad Request). 8 okt. 2019 09:52:24 ERROR
Got response from http request. 8 okt. 2019 09:52:24 DEBUG
Executing following request: GET https://api-internal-accpt.portofantwerp.com/ship-position/shippositions?min_lat=51.16221&max_lat=51.36609&min_lng=4.13116&max_lng=4.54726 HTTP/1.1 8 okt. 2019 09:52:23 DEBUG

Patricia

0 Kudos
GregoryChristakos
Esri Contributor

Hi Patricia,

One thing you could check is the mime type included as part of the polling request. Is there a specific mime type used by your API that isn't either of the defaults included with the "Poll an External Website for JSON" input connector? You could monitor for the response from the API request in the browser to help with determining this. Normally I would expect a status of 415 for this to be the issue, but I am not sure what the rest of your logs say. Nevertheless, I thought I would put this out there based on some of my experience with this type of behavior.

If you haven't done so already, I might also suggest trying to enter the entire request URL in the URL parameter as opposed to segmenting it via the other parameter properties. This helps reduce the likelihood of an incorrect URL being provided (this is unlikely).

Ideally we would want to take a closer look at the rest of your logs to see what exactly may be going on here. It might be worth reaching out to Esri Support Services to assist with this if no other suggestions are of immediate benefit.

Kind regards

Gregory

PatriciaBongaerts
New Contributor II

Hi Gregory,

Thank you for your suggestion.

I managed to solve the problem by limiting the Acceptable MIME Types to application/json.

bye,

Patricia

JeffreyWilkerson
Occasional Contributor III

This works for me because I have a JSON service I'm trying to access. Everytime I do an new JSON service it comes in with MIME typ 'text/json, application/json', and if I just limit it to 'application/json' it works fine.

0 Kudos