Alteryx Designer Desktop Discussions

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

API PATCH

MD2050
8 - Asteroid

Hello Everyone- 

We have been struggling with this issue for few hours now and would really appreciate if we could get some direction (i read all the blogs posted and reached up to this point) . What we are trying to do here is to update 3 field values using a PATCH process , below snippet shows the AWF. Instead of building a JSON string using the tool we built the TEST string inside the formula tool looks like below , we are trying to update 3 values - "Code", "ShortName" and "LongName". 

 

{"Culture":{"Code":"en-US","ShortName":"Eng(US)","LongName":"Eng(US)"}}

 

Field schema is correct as we extracted it from the input data (which is in JSON format which gets parsed using JSON parser.)

I have also pasted the "Download Tool" configuration screens below - we tried using Basic>>Output>>string , Basic>>Output>>Blob , we got following message

 

{"Message":"The request entity's media type 'application/x-www-form-urlencoded' is not supported for this resource."}

 

so we tried adding Name = Content-Type and Value = application/x-www-form-urlencoded or Name = Content-Type and Value = application/json.  

 

Upon using the Basic>>Output>>Blob and Name = Content-Type and Value = application/json we didn't see any error under download data but do see below which means the PATCH process didnt work. Any idea what we are missing here ? Is it the string schema which we are trying to push that is not excepted or something else ?

 

MD2050_5-1634757387353.png

 

 

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Content-Length: 339
Expires: Wed, 20 Oct 2021 20:46:33 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Wed, 20 Oct 2021 20:46:33 GMT
Connection: close
Strict-Transport-Security: max-age=15768000 ; includeSubDomains

MD2050_1-1634756518651.png

 

MD2050_2-1634756710178.png  

 

MD2050_3-1634756728868.png

 

MD2050_4-1634756753216.png

 

 

Thank you,

M

16 REPLIES 16
BrandonB
Alteryx
Alteryx

Hi @MD2050 

 

Do you happen to have a link to the API documentation? Also, have you tried pasting the JSON directly in the "Use Following for Query String/Body" option at the bottom? A 400 bad request error generally means that your JSON isn't formatted properly, although I'm not sure if that is the case here. A quick look at the documentation might point the community in the right direction to help. 

BrandonB
Alteryx
Alteryx

Also, when you changed the Content-Type, you did this in the headers tab, correct? 

MD2050
8 - Asteroid

Gm @BrandonB -

 

Thank you very much for your reply. 

 

Apologies, I don't have the link to the API documentation . 

Correct, I changed the content type under Header tab . 

 

I just tried your recommendation and received the following message - Initially, I didn't add any setting under the header tab for content-type although when I saw the message it mentioned content-type = application/json . I added the same under header tab and processed the code again , message after (*****)  is what I got then not it shows BAD REQUEST with a different content type.

 

I also formatted the string and pasted it under the "Use Following for Query String/Body" shown in the subsequent snippet with proper indentation from MS code writer tool

 

HTTP/1.1 401 Unauthorized
Content-Length: 0
WWW-Authenticate: Basic
Access-Control-Allow-Credentials: true
Expires: Thu, 21 Oct 2021 13:02:27 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Thu, 21 Oct 2021 13:02:27 GMT
Connection: close
Strict-Transport-Security: max-age=15768000 ; includeSubDomains

HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json
Content-Length: 117
Access-Control-Allow-Credentials: true
Expires: Thu, 21 Oct 2021 13:02:28 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Thu, 21 Oct 2021 13:02:28 GMT
Connection: close
Strict-Transport-Security: max-age=15768000 ; includeSubDomains

 

*******************************************************************************************

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Content-Length: 339
Expires: Thu, 21 Oct 2021 13:08:07 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Thu, 21 Oct 2021 13:08:07 GMT
Connection: close
Strict-Transport-Security: max-age=15768000 ; includeSubDomains

 

MD2050_0-1634821992118.png

 

Thank you ,

M

 

BrandonB
Alteryx
Alteryx

Do you happen to have a working example in POSTMAN? If so, I have found the easiest way to translate it into the Alteryx equivalent is by looking at the code snippet that is accessible on the right side of POSTMAN. I put together a blog article that covers some of this: https://community.alteryx.com/t5/Engine-Works/APIs-for-Beginners-Integrate-All-the-Systems/ba-p/8074... 

 

My other question is regarding the "HTTP/1.1 401 Unauthorized" which seems that the credentials also may not be passing correctly. It looks like it is leveraging basic authentication which I have an example of in the link above. 

apathetichell
19 - Altair

add  Content-Type: application/json as a name/value pair in your header. as @BrandonB noted - I don't see anything regarding authorization in your workflow - is it in the URL? Is it in  base64?

MD2050
8 - Asteroid

Thank you @BrandonB  -

I have not used Postman , i am going through some videos to recreate this scenario in postman. When you say "credentials", i am assuming you mean connection details - is that correct ? if yes, then i have them configured and they are working fine as i use them for GET procedure too. 

MD2050_0-1634825257955.png

 

Please advise if i am missing anything or have an incorrect configuration. 

Thank You, M

 

apathetichell
19 - Altair

Try it in postman and see if it works.

MD2050
8 - Asteroid

Thank you @apathetichell 

Yes, i manually entered the name/value pair under "Header" tab and when i processed the code i got another message which has a different "content-type" .

 

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Content-Length: 339
Expires: Thu, 21 Oct 2021 13:08:07 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Thu, 21 Oct 2021 13:08:07 GMT
Connection: close
Strict-Transport-Security: max-age=15768000 ; includeSubDomains

apathetichell
19 - Altair

can you show me a screen grab of your header name/value config? I know... It sounds silly. Also - have you tried with encode url checked?

Labels
Top Solution Authors