Trying to use the download tool in Alteryx for the first time, but running into some issues. Namely, the API call returns the following error:
"The body of the request, which was expected to be JSON, was invalid, and could not be decoded. The start of an object { or an array [ was expected."
The weird thing is that the call works fine on postman with the same configuration.
Attaching below postman and workflow screenshots.
Post=postman headers, cap2=postman payload
Headers=alteryx headers, payload=alteryx payload
Any ideas?
Solved! Go to Solution.
I recently had some trouble using the payload as a field. I ended up using a batch macro to update the update the payload in the call instead and it started working fine! Same situation - request was working fine in Postman. You might want to give that a try!
Cady
Hi @BrandonB ,
Thanks for the link, I already went through the article. It was helpful but couldn't solve my issue. Also, I didn't paste in the body that is seen in the post.PNG picture. That was what was returned by the server after sending the API call.
Basically for the service I'm trying to use, you send a post call to get an authentication key (which I did and works fine), then you send another post call to get a subscriptionId (kind of like a second key), as seen in post.PNG. However the second post call I'm trying returns the JSON format error described above.
@cadyb Unfortunately I have no idea how to use batch macros or how they can work together with the download tool. Can you elaborate?
I think I narrowed down the issue to my payload being wrong. From what I read in this specific API's documentation, the following is needed:
{"accounts":{"transactionHistory":"true","balance":"true","details":"true,"checkFundsAvailability":"true"}, "payments":{"limit":100.00,"currency":"LSL","amount":18.32101}}
I'm not a programmer, but reading articles on the alteryx download tool I know "accounts" and "payments" are supposed to be the names of 2 of the objects in the "query string/body" section of payload in the download tool, and their values should be the multiple values listed in their respective tables/arrays (whatever they're called).
My problem is, I thought that alteryx can only receive 1 name, 1 value at a time. How do I configure the tool to have 1 payload name with multiple values as shown above? Or do I have to list "accounts" as name 4 times and give it 4 different values for example? Even so, how would the syntax look like in the download tool? It seems each time I have 2 names and 1 value. i.e. Accounts>TransactionHistory: true, Accounts>Balance:true, Payments>Limit: 100, Payments>Currency: LSL. Download tool only gives 1 cell for name and 1 cell for value.
EDIT: I buypassed the query editor that the download tool comes with and just selected "take body from Field", and copy pasted the array in the field. It works now.
User | Count |
---|---|
19 | |
14 | |
13 | |
9 | |
8 |