community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Community v19.6

Looks aren't everything... But the latest Community refresh looks darn good!

Learn More
SOLVED

"request_syntactically_incorrect" on Post API

Highlighted
Fireball

Hello,

 

I tried to use a Post API and received this error message in download tool:

 

DownloadData

 

 

{"errors":[{"code":0,"message":"request_syntactically_incorrect"}]}

 

 

DownloadHeaders

 

 

HTTP/1.1 400 Bad Request

 

 

In postman, I use Body (raw) and successfully run the post API.

postman.png

In Alteryx, I've tried multiple different ways (Compose Query String/Body, Take Query String/Body from Field, and Use Following for Query String/Body) but none of them worked.

 

Basic

download-basic.png

 

Payload

download-payload.png

 

Does anyone know how to set up the download tool for post API?

 

Sincerely,

knozawa

Alteryx
Alteryx

Hi @knozawa 

 

It looks like you have 9 headers set up in Postman as well, have you replicated these inside the download tool as well?

Fireball

Hi @JoeS ,

 

No, I didn't replicate it inside the download tool.

 

It seems like the headers are auto generated by Postman:

postman-headers.png

Do you think there is a way to auto-generate those headers using download tool?

 

Sincerely,

knozawa

Alteryx
Alteryx

There will be some parts that are auto generated.

 

Due to the nature of API's and their "flexibilty" it can be quite hard to diagnose what's going on.

 

Have you tried changing the body to not have the wrapping parenthesis? AKA deleted the start and end brackets.

 

Failing that it may be best if you could send me the full details by PM and I'll look to get it working my side and can return how?

Fireball

Hi @JoeS ,

 

I deleted the "{" and "}", but it didn't work on Alteryx.  I will send you the full details through private message. 

 

Thank you for your help!

 

Sincerely,

knozawa

Alteryx
Alteryx

Hi @knozawa 

 

Thanks for sending the details through, I thought I'd put the answer back here in case anyone else comes up against the same issue.

 

What you had done was correct, the only part that was missing is that when you use the payload option "Use Following for Query String/Body" it sets Content-Type to "application/x-www-form-urlencoded"

 

What you need to do is add to the header "Content-Type" and then your API needed "application/json".

 

2019-07-05_09-09-39.jpg

 

What also tripped me over is if you add to the header "content-type" AKA all lower case, it will actually end up sending "Content-Type" and "content-type" which then throws the error you were getting around incorrect syntax.

 

I'll PM you back the working workflow as well. 

Fireball

Hi @JoeS ,

 

Thank you very much!  I could successfully send the post API call through Alteryx after adding the header in the download tool. 

 

Sincerely,

knozawa

Labels