Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

API http POST - Loop/Array - Works in Postman

Alc2020
7 - Meteor

Hi,

 

I am new to Alteryx Designer.  I have the following sample data in json.  I can upload these data in Postman using iteration with no issues.  How can we automate this in Alteryx Designer?  I was trying with the Download tool but cannot get success.  Do I need to use other Alteryx tool to solve this?

 

Thank you in advance!

 

data.json

 

[
	{
		"cusomerId": 9000,
		"productId": 5
	},
	{
		"cusomerId": 9001,
		"productId": 4
	},
	{
		"cusomerId": 9002,
		"productId": 3
	}
]

 

8 REPLIES 8
BrandonB
Alteryx
Alteryx

Have you gotten it to work with one of the JSON brackets? Make sure that the HTTP action is set for what you want in the payload tab, and put your JSON in the section down at the bottom "Use Following for Query String/Body"

 

{
		"cusomerId": 9000,
		"productId": 5
	}

 

payload.png

BrandonB
Alteryx
Alteryx

From your screenshot it looks like you are using the POST HTTP action so make sure that dropdown is set appropriately. 

Alc2020
7 - Meteor
Hi,

It works for single transaction only in Alteryx via Input tool and Download
tool (http post). I'm looking for bulk automation. In this example, I
wouod like to upload three records at once.

Thanks
BrandonB
Alteryx
Alteryx

Could you put these into the text input tool in the beginning of the workflow and then use the query from string and use the field that corresponds to the JSON in the text input? It should then execute one call for each row which would accomplish your objective.

Alc2020
7 - Meteor
Hi,

I think it will work. Let me try later today.

However, how will the new record will be recognised in such case?

Thanks
BrandonB
Alteryx
Alteryx

There will be one row coming out of the download tool for each url and payload passed in. You can parse the JSON results from the download data column using the JSON Parse tool. 

Alc2020
7 - Meteor

Thank you very much for the tips.  This is now resolved.

 

Awesome! @BrandonB

 

I ended up like the workflow snapshot attached. 🙂Workflow.PNG

BrandonB
Alteryx
Alteryx

Thank you for sharing!

Labels