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
10 - Fireball

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
10 - Fireball

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

apathetichell
18 - Pollux

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
10 - Fireball

@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
18 - Pollux

@BonusCup common problem! 

Labels