Hey guys, I have been struggling to wrap my head around this for a few days now. I have found numerous threads on the forum about this as well, but none of them cover the exact format to make this work.
When using the API connector, how do you format the part of the JSON body that allows you to plug in dynamic lists (arrays) of data?
In all the examples I have found on the forum they have something like this:
What I am not understanding is how you plug in / pass the dynamic list of Users, when the only dynamic thing we have here is user name? I feel like I am missing something fairly obvious here, but have looked forever and can’t find a good example of where someone shows how they formatted this on the API connector side.
My use case for this is that I am using Postmark for various notifications/messages for users on my platform. And I am now trying to use it to send calendar invite emails. To do that, I need to pass through a list of users (with names and email addresses).
Happy to share more context, screenshots, etc. if needed.
Also, pre-Thank you to @johnny for agreeing to help out and for intelligently suggest I post it publicly so he can help me while also helping the entire community
The first thing you probably should do is to search forum Already a lot of answer about that.
you will format the list dynamically in the action or get data request using :format as text
For example, users will be Do a search for user:format as text. In the first part, you will write {“user_name”: “This user’s name(dynamic)”} and in the second part, enter ,(comma) for delimiter
In API connector: “users”:[<list_of_users>]
And that’s it? Cause I was trying that and unable to initialize before, so maybe I have formatting wrong somewhere else… Of course in my exact JSON there are a bunch of things where I could have it incorrectly formatted.
yes ths is the setting you should have in API Connector. Now, if you are not able to initialize, this may be because of the data in “value” you entered are not correct. Share the whole screenshot of API Connector and the data used to initialize
I don’t know the values you will enter, so it may create issue if not entered correctly. However, you already have an invalid JSON because you have a comme after attendees]
Wow. I had a feeling there was going to be something obvious. That worked, at least for initializing it. I’ll keep working on it to ensure the rest of it works correctly. From what I understand and saw about formatting the list items as text seems pretty straightforward.
Alright, I might have spoke too soon. I am stuck again on getting the correct formatting for the list of attendees.
It will initialize if I leave the value blank, but I can’t seem to initialize it when I put in static data on the value or when I use dynamic data:formatted as text.
I thought it should be just
{
“name”:"John"
},
{
“name”:"Cole"
}
Or when put directly into the value for api connector:
Ahh I see. That worked for the initial static value, but not for the dynamic one I am plugging in.
I feel like I saw once on the forum that you need to do commas in both the content area and the delimiter? I tried both (amongst a variety of other combinations) but still keep getting an error.
I also checked to make sure it wasn’t anything else, when I remove the dynamic data for the attendees it works, so I am pretty sure it is something in there (my guess having to do with commas and/or delimiter).
I ended up getting this part to work. For anyone who finds this and is struggling, this is what I did…
I kept pretty much everything as seen above. The only change that finally made it go through was to make the Participans:format as text as follows
SO in the content to show per item section I have it as:
{“name”: dynamic text:formatted as JSON-safe}
Then for the delimiter I have:
,
NOTE: There is a space between the colon and the dynamic text. ALSO, there is a space after the comma.
Finally, I will add that I am not an expert in this stuff, nor do I really know how/why it finally worked for me that way. But hopefully, if you run into issues, someone much smarter than me such as @Jici can help you through it