Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Download Tool API Payload Format

Colin_Dawes
6 - Meteoroid

Hi

 

New to this....I've got an API issue... I'm trying to upload some data but getting stumped with the format.

I can GET data and authorisation works with no problem... I can even upload certain fields at the basic level, but getting stuck using the Download Tool Payload where the required attribute is a lower 'subset'.

 

The URL requires PATCH to upload the data and this works:

 

Colin_Dawes_0-1681462396485.png

 

I believe this is the same as :

 

{

"sku": "R0412GRY10L",
"description": "6204.69.2810"

}

This worked with no errors.

 

Colin_Dawes_4-1681463274997.png

 

 

However, I want to be able to upload the following:

 

{

"sku": "R0412GRY10L",
"description": "6204.69.2810",

"classifications":[{"codes": ["6204.69.2810"],"region": "US"}]

}

 

 

I cant get the 'region' & 'codes' to work... my error is saying 400 "Unknown Attributes"

I've tried naming the attributes in different ways see here:

 

Colin_Dawes_3-1681463048072.png

 

 

Colin_Dawes_2-1681462982139.png

 

Colin_Dawes_5-1681463350305.png

 

 

Is there a specific way to reach the "Classifications" sublevel? Should I be doing it on a separate URL?

Thanks

 

9 REPLIES 9
PhilipMannering
16 - Nebula
16 - Nebula

If you had this,

'{
"sku": "R0412GRY10L",
"description": "6204.69.2810",
"classifications":[{"codes": ["6204.69.2810"],"region": "US"}]
}'

 

in a Formula Tool (called, say "my_payload") and used that field in Take Query String/Body from Field in the payload tab of the Download Tool, does it work?

Colin_Dawes
6 - Meteoroid

Hi. I did yes

 

Colin_Dawes_0-1681468290280.png

 

Colin_Dawes_1-1681468358015.png

 

 

I get the same Unknown Attribute error... but I think this one is failing the whole script as unknown... looking at the error text more closely

Colin_Dawes_2-1681468664210.png

 

whereas previously 'sku' & 'description' worked fine as an attribute

 

PhilipMannering
16 - Nebula
16 - Nebula

And this is with all other fields unchecked in the Payload? I'm stumped then.

Colin_Dawes
6 - Meteoroid

It is yes... 

 

 

Colin_Dawes_0-1681471121762.png

 

Yep me too!

patrick_digan
17 - Castor
17 - Castor

@Colin_Dawes in case it makes a difference, when you use @PhilipMannering 's suggestion about the payload can you also add a header to set the Content-Type to application/json

patrick_digan_0-1681473228345.png

 

Colin_Dawes
6 - Meteoroid

hi @patrick_digan 

 

Yes have that as a header - and it works on all GET and the original PATCH

 

Colin_Dawes_0-1681473899449.png

 

patrick_digan
17 - Castor
17 - Castor

@Colin_Dawesinteresting. I think the Accept header and Content-Type header are 2 separate things. 

Colin_Dawes
6 - Meteoroid

@patrick_digan @PhilipMannering  It worked!!

Colin_Dawes_0-1681474803835.png

 

and also putting the Payload in as a string from the Formula tool.. excellent thank you both!

PhilipMannering
16 - Nebula
16 - Nebula

Woop woop. Good, this was bugging me.

 

Yeah, Content-Type and Accept refer to the format of what you send and what you receive respectively. Thanks @patrick_digan  Glad it worked.

Labels