Alteryx Designer Desktop Discussions

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

Question about call API in alteryx

tamluenwai29
6 - Meteoroid

Hi everyone, 

 

I am new to Alteryx and I am going to retrieve the data from a website.

Before I retrieve the data from the website, I have to input the user name and user password to login the website for authentication. 

 

I got the following information up to now: 

1. Request URL 

2. Request Method: POST 

3.1 Request Header: Content-Type: text/xml;charset=utf-8

3.2 Request Header: SOAPAction: urn:excute

4. Request Body 

5. Username 

6. Password

 

I would like to know how can I pull all the stuff in alteryx to conduct authentication and retrieve the data successfully? 

Thanks you guys a lot!

5 REPLIES 5
cmcclellan
13 - Pulsar

You will want to concentrate on the Download tool to do this and hopefully you can send the username, password and other details in a payload via that tool.

 

I know I'm being vague, but every API works differently and user authentication adds to the complexity.

 

tamluenwai29
6 - Meteoroid

Thanks for your reply, do know whether I can put the request body in the download tools?

 

<?xml version ='1.0' encoding= 'UTF-8'?>

<soapenv:Envelope xmlns:soapenv="...........">

    <soapenv:Body>

        <execute xmlns="...........">

            <params>

                <method>...........</method>

                <userName>...........</userName>

                <password>...........</password>

                <projectCode><...........></projectCode>

                <gtPageSize>20</gtPageSize>

                <gtPageNum>0</gtPageNum>

                <showProjectQuality>true</showProjectQuality>

                <showProjectSchedule>true</showProjectSchedule>

            </params>

        </execute>

    </soapenv:Body>

</soapenv:Envelope>

apathetichell
19 - Altair

Create  a text input tool - put your soap body there (ie what you posted). If you need to (if it's multiple lines) use a summarize tool. concatenate it with /n as your seprator.

 

append your fields which you described above.

use a formual tool to replace([concat_payload],'<userName>...........</userName>','<userName>'+[userName]+'</userName>')

use a second part of the tool to replace([concat_payload],'<password>...........</password>','<password>'+[password]+'</password>')

 

do the same for any other api parameters via whatever fields you have.

 

do you have xml special characters in your username or password? use a new formula tool to replace them. - note - this may or may not be necessary.

 

you can now try your download tool. feed in your payload in the body. feed in your url via  field. feed in your content-type to your header by your content-type.

 

try. see 500 error. read 500 error. fix 500 error.

 

Can you share what API this is? These - 

<soapenv:Envelope xmlns:soapenv="...........">

    <soapenv:Body>

        <execute xmlns="..........."> - are probably not private and are in a public .wsdl file. 

tamluenwai29
6 - Meteoroid

Hi, thanks for your reply. But I still have some confuse about how to input the request body. 

 

Up to this moment, I have dragged the text input tools to the canvas, inside the input tools I have created a column named to "URL" and pasted the end point URL.

 

Afterwards,I have linked the download tools to the text input tools. 

 

I have added the Content-Type and SOAPAction under the "Headers" tab in download tools configuration, and I have also set the HTTP Action to "POST" under the "Payload" tab in download tools configuration. 

Lastly, I have inputted the Username and Password under the "connection" tab n download tools configuration. 

 

I am trying to run this workflow, but I got the following error log:

HTTP/1.1 500
vary: origin,accept-encoding
Access-Control-Expose-Headers: Access-Control-Allow-Origin,Access-Control-Allow-Credentials
X-XSS-Protection: 0
Content-Encoding: gzip
Content-Type: text/xml;charset=utf-8
Date: Wed, 19 Jun 2024 06:38:02 GMT
Connection: close

 

I have no idea how to put the request body to the workflow, is it possible to put it in the download tools --> payload --> Compose Query StringBody? I would also like to know whether the previous set up is correct.

 

Again, thanks all of your reply.. Thanks so much! Attached the download tools configuration in this comment down below. 

Transfer-Encoding: chunked1.png2.png3.png4.png

 

apathetichell
19 - Altair

Check - take query string/body from field in the payload tab. send in your payload. Notes:

 

1) everything has to be in the same row. use append fields if needed.

2) I'd strongly strongly recommend testing this in Postman first - and seeing if you need to adjust syntax somewhere. Postman auto-adjusts and other members of your team should have previously established to this source system - which again would be very very helpful if you told us what it was.

3) Fix the errors in Postman - match the curl command code in Alteryx.

4) you should not need username/password in your connection tab. It's in your Soap payload.

 

Labels