Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Download tool don't work for API

jeneir
8 - Asteroid

I have set up an API POST call in Postman and it works fine.

When I try do recreate this in Alteryx with the Download tool I get this message:

 

HTTP/1.1 400 Bad Request

{"Message":"The request is invalid.","ModelState":{"authenticationInfo":["Unexpected character encountered while parsing value: a. Path '', line 0, position 0."]}}

 

It seems like the URL and headers are fine. The problem is the Payload where it takes in a JSON string (authenticationInfo) with username and password.

I've tried using every option in the Payload settings, including reading the JSON from Text input and as plain JSON in "Query String/Body".

 

When I google the error message most posts says the JSON string is not deserialized correctly. Is this an error with the Download tool?

Here's the JSON:

{
    "UserName": "string 1",
    "UserPassword": "string 2"
}

 

[EDIT]

I tried calling the API with the Python tool and got the same error.

7 REPLIES 7
grazitti_sapna
17 - Castor

Hi @jeneir , did you try passing the username and password in the compose query strings as highlighted below?

grazitti_sapna_0-1604390034726.png

or try passing along with the url by creating separate fields and use those fields in one of the options.

Also, you can try passing the creds in the connection tab as well.

grazitti_sapna_0-1604390751838.png

 

 

Thanks.

 

Sapna Gupta
jeneir
8 - Asteroid

Hi!  I tried to add UserName and Password to Compose..., but that just gave me a time-out.

Then tried to pass authenticationInfo as a JSON but that gave the same error as before.

 

authenticationInfo     {"UserName": "username","UserPassword": "password"}

 

Is it possible to view the raw data Alteryx send? Maybe the Download tool uses an american apostrophe to enclose the string or something?

 

[EDIT] Tried Conncetion tab also, gave a time-out.

BenMoss
ACE Emeritus
ACE Emeritus

Let's start by asking the simple questions first, I don't think it will be a problem with the download tool itself as otherwise I'd expect many people would have bumped into a similar issue.

 

Firstly, have you definitely set-up the download tool to make a post request?

 

If you are sending the API request as JSON, have you created a 'Content-Type' header which is given as application/json?

 

Personally, I would place the json in a formula tool with the name 'authenticationInfo' and use the following formula...

 

'{"UserName":"username","UserPassword":"password"}'

 

And then check use this configuration...

 

2020-11-03_08-25-50.png

 

If you can share screenshots of you config in postman vs. Alteryx then that will help further of course, alongside details of the API, is it one that others can easily subscribe too to test?

 

Ben

 

 

 

jeneir
8 - Asteroid

Thanks for reply.

I tried adding the formula tool but didn't help.

 

Postman:

jeneir_0-1604393276328.png

 

Alteryx:

jeneir_1-1604393408272.png

I tried with just application/json too but was no difference.

jeneir_2-1604393436791.pngjeneir_3-1604393681682.png

 

 

API doc: https://www.altinn.no/api/Help/Api/POST-authentication-authenticatewithpassword

 

 

Still getting the error...

{"Message":"The request is invalid.","ModelState":{"authenticationInfo":["Unexpected character encountered while parsing value: a. Path '', line 0, position 0."]}}

 

BenMoss
ACE Emeritus
ACE Emeritus

@jeneir can you change the payload tab to that specified by the post I gave, i.e. by using the 'take query string/body from field' option and selecting your field there.

 

I believe this may then resolve your issue.

 

Ben

jeneir
8 - Asteroid

tried all ways possible.

 

field from formula tool

jeneir_0-1604574680697.pngjeneir_1-1604574823284.png

 

 

BenMoss
ACE Emeritus
ACE Emeritus

I'd consider reaching out to Alteryx Support whom will be able to help you more pro-actively (i.e. on a call, rather than a load of back and forth on here).

 

Sorry I can't be of more help, but I've got you too a different error message at least! 😂

 

Ben

Labels