Extracting data from an API

I have an issue using data from an API in Triggre.
I use an API to get two different types of information back.
First I get a list of employmentId’s. This list is used to get the second part which is a list of multiple different components that I want to get inside of a table. These components need to be linked with the employmentId.
This is because I want to have an employmentId and underneath it a list of all the components that are connected to this employmentId.
So it would look something like this:
employmentId: X
payrollComponentResults: Value
payrollComponentResults: Value
payrollComponentResults: Value
payrollComponentResults: Value
etc…
I use the following statement to get data back from the API :

If I use the get from flow part. Then the result is that when I select from flow part and use the “value” output I get the value of every component of every single payrollComponentResult. The same happens when I ask for the employmentId’s then I get a list of all the employmentId’s.
As you will see in the next picture, the value’s are from all the components.

So my question is, how do I link these 2 values together?
For more information this is how it looks like when we make the call in Postman:

As you can see, 1 employmentId and underneath it multiple (20+) components. When all the components are done, then the next employmentId is used. employmentId and payrollPeriods are in the same {}.
So my question is, How do I get the data in a way that it is still know that value AAA is connected to employmentId 124-a1b2-4567-c8-d9.

If you need more information feel free to let me know!

Hi @lode.pijpelink,

Thanks for posting your question in the forum. The situation that you are running into is something that we are actively developing a specific feature for.

I think that @Eddie has come up with a solution to a similar problem, so I will ask him to check if that could also work in your case.

You’ll hear from us again ASAP!

That is correct. You have two possible options:

  1. Data triggre
  2. Connection triggre

1. Data triggre
You save the employmentID. You create a Data triggre which calls a webAPI to retrieve the information for just this specific EmploymentID. This does however require the availabilty of a Web API for specific employments.

This is an asynchronic way to retrieve the data, since Data triggres are always executed in the back-ground of the application.

image

2. Connection triggre
Create an incoming interface which has two inputs (in this case). The employment ID and a list of Values. When you are doing a repeat action on every employmentID you connect to your own Web API and send the employmentID and the list of values. You can process the item in a flow part where you can do a repeat action over all values and save both each value and the employmentID.

Important to keep in mind is that this is a synchronic way of processing this data. In case there’s an error in the dataset nothing will be stored. Also, when you receive too much data it could cause a timeout.

image

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.