Restricting API response data

Hey all,

Within SC, I haev an API Action - the API returns a LOT of data. I need this for some SC’s, but not all.

One of which, I’ve just gone into the Define Schema and then reduced the response schema down to 3 arrays that I need only for that specific SC.

The problem is, when I then run the SC - I still get the full data output.

It looks correct in the ‘Define Office Schema’ and it also looks correct when I open up the JSON file. So I’m not sure what I’m doing wrong here? Any guidance or might this be a bug?

The schema is there to just help with the pickers.
It does not define what gets outputted.

To restrict the output, you will have to use SET VALUE, and set the value of the variable to required array. For 3, you will have to do this 3 times.

In case you have just 1 array, you can use the response step instead and set that path in value part.

Thanks @sid for the clarification on the response schema.

I’m trying to find the most performant solution here, as the SC is already slower than I would like it to be - and that’s before the DB starts filling up.

What do you think would be most performant from these two scenarios:

Option 1 (current scenario to get it working, before improving)
External API Call (Full schema!) response.
Repeat on the API data
Repeat on array 1 from the API Data Repeat - all following SC actions (inserts, updates)
Repeat on array 2 from the API Data Repeat - all following SC actions (inserts, updates)
Repeat on array 3 from the API Data Repeat - all following SC actions (inserts, updates)

Option 2:
External API Call (Full schema!) response.
Set Value on a ‘restricted’ Schema, only outputting the 3 arrays and the UID of the external API call (must keep this).
Then repeat on Set Value
Then Repeat on the 3 arrays as above each individually.

I might be doing it wrong - but I am repeating this way becase we need to maintain the unique external id.

Repeat and output are two different things.

Whether you repeat on the arrays direct by referencing from the api response, or by moving it to a set value - does not matter.

1 Like

Ok, thanks @sid appreciate the feedback.

Maybe this will be useful for you:

1 Like