Hi Ajay Phalke
I think you are looking for grouping this can be done in a microflow:
1- Create a non-persistable with the attributes you need I think it will be ID, quantity,...etc
2 - after you get the response of the API you can use a sort list operation to sort it by ID
3- then get the head of this sorted list
4- Create a variable to save the ID of the head lets name it ID.
5- Create a list of the non-persistable entity you created name it FinalList to return it in the end event.
6- Create a list of the same sorted list type called ListToAggregate.
7-use a loop to iterate over all sorted objects with a decision if iterator/id = variable you created if true then use change list activity to add the object to the created list.
8- if false aggregate the list then create an object to the non-persistable entity to save the ID and the aggregated attribute then add it to the finalist then clear the ListToAggregate change the variable ID value of the new iterator then add it to ListToAggregate.
Please if this does the job recommend this answer as accepted answer
You'll need to apply some extra logic for that during the microflow that calls the API. For each record you retrieve from the API, you'll need to check whether this record exists by retrieving from your local database by its ID. If it exists, you can add the sum of the records to the existing object. If it doesn't exist yet, you can create a new object. Afterwards, commit all objects to the database to store the results.