POST Action in Integration Hub Always Getting 400 Response

Maurice Murphy
Tera Guru

I'm trying to create an action in Integration hub to POST to a prototype REST API, but when I set everything up, ServiceNow and the API are able to communicate, but no matter how I format my REST body, it says it's getting bad data.

I can't find information on Docs, the Developer site, or anything about using the POST function of IntegrationHub. The Developer Course has an entire section on GET and parsing, but nothing on POST or PATCH. 

How exactly should I be using this functionality? What's the different between Text, Binary, Multipart, and Form URL-Encoded?

I expected that if I just used Multipart and provided my three required parts of my response body, it would work, but it just spits back a 400 response. Any help would be greatly appreciated because I genuinely can't find anything.

3 REPLIES 3

Hitoshi Ozawa
Giga Sage
Giga Sage

Haven't tried POST on integration hub but when I do a post to ServiceNow APIs, 400 is returned when I have not set "content-type" in the header.

Frank Tate
Giga Guru
Giga Guru

Those request types are HTTP standards, and which one you choose usually depends on what the target REST API requires (the request type specifies the format of the data you're sending in the request). The 400 error states that the request from the client cannot be processed by the server, which usually means that the request is not in the correct format.

The best way, in my opinion, to start getting this to work is to remove ServiceNow from the client side of the picture. Try to create a request in curl, PowerShell Invoke-RestMethod or PostMan. Once you know what the request needs to look like, then try to make that same request from the REST Step in flow designer in ServiceNow. If you can create a valid request manually but are having problems getting the correct request created from ServiceNow, please provide a sample working request and response, and then we can help you configure the REST Step appropriately in flow designer.

Frank

Dylan Mann
Tera Contributor

Hi Maurice, have you made any progress on this? I'm also seeing the same issue.