Skip to main content

Hello,

First-time poster and generally new to Zapier so thanks in advance for helping me get familiar with what is helpful to post here for guidance. If there gaps or additional details that would be helpful, I would appreciate your coaching and patience.

Scenario

  • System A responds to API requests in JSON without a root node object identifier
  • System B is capable of importing data received in a JSON format but requires a root node
  • System A is not capable of placing a root note identifier at the top of the JSON
  • Trying to use Zapier to get data from System A to System B
  • The JSON responses from System A include nested nodes

Attempts

So far, I have tried something as simple as a single Zap with a Get trigger and a Post action, and something as complex as replicating what’s in these posts (1 and 2).

Current Result

While the single Zap approach seems to return data I can use with System B, it seems like what’s happening is that the Get request from Zapier into System A is returning each result from calling its API as its own individual JSON response (i.e. one record at a time). As a result, what I get in System B looks like four independent Puts, especially as there are four individual JSON files on System B’s side that it attempts to consume. I can’t determine if this is by design of System A but I suspect so.

Desired Result

What I’d like instead is for Zapier to ‘bundle up’ all the JSON responses it receives from the Get of System A before then performing a single Put of those assembled JSONs into System B -- and ideally with clean root node identifier that System B can then use to parse the JSON.

I thought that the above linked posts would lead to that (a few places I read said that the Code action would run multiple times within a single Zap before ending but perhaps I do not understand that well since I am new). The ‘longer’ sequence of two daisy-chained Zaps works but is still four individual JSON Puts / files into System B, instead of a single payload.

 

Perhaps there is an entirely different route to go about this. My thinking is that System A does not put a root node at the start of the JSON in the first place because its API is only intended to send one response at a time rather than a single response with multiple records in it. However, moving the data between Systems A and B cannot be single-record JSON transmissions as there will be hundreds on a daily basis. The lack of a root node identifier may be a red herring / non-issue at this point, as it seems that since the API responds in this way, my focus instead needs to be on how to take those multiple System A responses and make sure they get combined to a single JSON Put for System B.

I hope this explanation makes sense and that someone will be willing (and patient enough) to talk through some options.

 

Thanks for reading this far,

 

JM

Hello @Troy Tessalone,

Forgive the direct tag - I had seen you reply on some similar threads and wondered if you would be able to weigh in here.

Simplifying my original post a bit, I have a GET Webhook that responds with JSON roughly like this:

id: 123456
importID: abdefg
externalMembershipID: 654321
cardholders:
1:
id: 123456
...
2:
...
...

 

I get one response per record and I am hoping to combine each of those individual responses into one JSON payload to deliver to a downstream system (versus one PUT per record). The downstream system is rate-limited, hence why I can’t send these responses along individually.

As well, there is a scardholders] nest in this JSON response that needs to be preserved.

I am trying to get help from an expert via Zapier and have been connected but need to keep pursuing this while waiting to hear from the expert they connected me with.

I appreciate any time or advice you can offer,

JM


@JMC1 

Try adding a Delay After Queue step to smooth out the PUT requests per record to abide by the API limits.

https://zapier.com/help/create/customize/add-delays-to-zaps#delay-after-queue


Thanks @Troy Tessalone - I’m not wild about transmitting one record at a time but I will look at that option. I suspect you’re recommending that because it’s easier to rate limit than trying to combine all the solo responses into a single PUT. It’s not my preference since the downstream system is going to show all of these as individual incoming ‘files’ so to speak, but I can’t cling to that.

Minus the Delay After you’re recommending, what I currently have in my zap is:

  • Catch Raw - System A calls the zap to start
  • GET Webhook - performs GET from System B
    • Send as json: no
    • Unflatten: yes
  • POST Webhook - performs POST to System A
    • JSON payload
    • Wrap in array: no
    • Unflatten: yes

The

Line 4 fcardholders] node turning into single-value field itself

 

Thank you again,

JM


@JMC1 

The way the data needs to be sent in the API request depends on the API documentation you are referencing.

Are you able to share that?


@Troy Tessalone 

I’ve attached what I hope you’re requesting. I’m simply trying to relay the JSON as-is when it is returned by the GET from System A, for which the attachment corresponds. Somewhere in the process, the scardholders] nested node is being turned into a regular field like the rest and I need it to remain a nested node. I see it end up in System B as one field with a long value versus the nested node.


@JMC1 

You’ll likely need to use a Code step to parse/prep the returned API response before sending to the next API request.

This is because Zapier automatically returns the API response pre-parsed vs returning the raw JSON. (I have previously submitted a feature request for this.)

Alternatively, API requests can be made in Zap Code steps: https://zapier.com/apps/code/help