[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Posting JSON



I'm working on a project involving calls to web services (running under Tomcat), and the ones requiring GETs have been working fine so far.

But the first time I tried a call requiring a POST, I got (once I got all the obvious bugs ironed out) a "HTTP/1.1 400 Bad Request"

I tried copying and pasting the POST data into the Swagger "playground" for the web service, and it worked perfectly.

I tried explicitly adding the JSON-specific headers "Content-Type: application/json" and "Accept: application/json", even though JSON is the default for the web service, and the GETs worked fine with only the authorization token in the header.

Looking at the debugging data, I found this (private information redacted):
POST /rest/record/findbycondition?objectSchemaName=installed_products HTTP/1.1
Host: <redacted>.com:8090
User-Agent: http-api/1.24
Content-Type: text/xml
Content-Length: 172
Cookie: $Version=0; JSESSIONID=A41F952D7F887452B40FBBD01E7EBD39; $Path=/;
Authorization: Bearer <redacted>
Content-Type: application/json
Accept: application/json

and a more detailed response from the server:
The request sent by the client was syntactically incorrect.

It appears that HTTPAPI is putting in an unwanted "Content-Type: text/xml." Could that be the cause of my grief? If so, what do I do about it?

If not, any other ideas?

--
JHHL
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------