Alteryx Designer Desktop Discussions

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

Cannot recreate API call with the download tool.

cgoodman3
14 - Magnetar
14 - Magnetar

I am trying to recreate an API request using the download tool, but I am failing to get the expected result back.  The API I am trying to connect to is: https://use-land-property-data.service.gov.uk/api-documentation

 

Within the documentation it states that you need the API key in an Authorization header and also an Accept header with the value application/json. I've been able to successfully recreate this in Postman and the python script generated is as follows:

import requests

url = "https://use-land-property-data.service.gov.uk/api/v1/datasets/history/ccod/CCOD_FULL_2022_06.zip"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': '[MY API KEY ENTERED HERE]'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

 

However when trying to replicate this in the download tool I am encountering an error. This is my set up:

cgoodman3_0-1660558729465.png

 

cgoodman3_1-1660558815986.png

 

N.B. I have my actual API key entered in my workflow.

 

The response back is a html page with a bad request message. Is there anything else that needs to be configured?

 

Thanks

 

 

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
5 RESPOSTAS 5
PhilipMannering
16 - Nebula
16 - Nebula

Hey Chris.

Try adding another Header, Name = `user-agent` and Value = `Mozilla Firefox`.

cgoodman3
14 - Magnetar
14 - Magnetar

Thanks @PhilipMannering adding in the extra User-Agent did the trick.

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
MarqueeCrew
20 - Arcturus
20 - Arcturus

@PhilipMannering ,

 

How did you figure that out? 

 

I got curl to work with:

 

RUN Command

Command:  curl.exe

Arguments:  --header "Authorization: 99999999-9999-9999-9999-999999999999" https://use-land-property-data.service.gov.uk/api/v1/datasets/ccod -o c:\users\markf\Downloads\output.txt

 

Input... pick a dummy dataset

 

Cheers,


Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
PhilipMannering
16 - Nebula
16 - Nebula

@MarqueeCrew Lucky guess.

PhilipMannering
16 - Nebula
16 - Nebula

... nah it's something I've done a few times to get APIs to work.

Rótulos