In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Iterative macro to POST multiple json objects

BonusCup
11 - Bolide

Hi,

 

API documentation: https://developer.suralink.com/endpoint-docs

API URL:  https://api.suralink.com/v1/

 

I've created a workflow to POST new clients to Suralink but having problems trying to create multiple clients at once.  As I am relatively new to working with APIs, I'm guessing that I need to create each client individually.  I've tried encapsulating multiple objects in brackets and curly brackets but no success.  Also, when using the JSON Build tool, when I don't group by any field, why does it not create the close and open curly brackets in between each object separated by a comma or the regular brackets to open and close?

jsonBuild.JPG

JSON Build output:
{"clientIdNumber": "STRING","departmentId": INTEGER,"name": "STRING","customId": "STRING","clientIdNumber":"STRING","departmentId": INTEGER,"name": "STRING","customId": "STRING"}

 

Testing in Postman

Single client, works:
{
"clientIdNumber": "STRING",
"departmentId": INTEGER,
"name": "STRING",
"customId": "STRING"
}

Multiple clients, does not work: Error message, "You must provide property "name" of type string."

[
{
"clientIdNumber": "STRING",
"departmentId": INTEGER,
"name": "STRING",
"customId": "STRING"
},
{
"clientIdNumber": "STRING",
"departmentId": INTEGER,
"name": "STRING",
"customId": "STRING"
}
]

 

I'm able to create an iterative macro for pagination but getting stuck on looping to POST each individual record.  Can someone help with this?

 

4 REPLIES 4
BonusCup
11 - Bolide

Still haven't found a solution.  Hoping someone has created something similar. TIA

apathetichell
20 - Arcturus

1) you probably don't need an iterative macro.

2) I did a cursory look through your api documentation - and I do not believe it supports batched operations.

 

Assuming you create each record individually - where are you hitting a stumbling block?

BonusCup
11 - Bolide

@apathetichell thanks for the reply.  Digging deeper into my workflow I found the issue.  It was such a 'FACEPALM' moment!  I failed to enter the below header:

Content-Type: application/json

 

After entering that I was able to create 6 test clients at once.

 

apathetichell
20 - Arcturus

@BonusCup common problem! 

Labels
Top Solution Authors