Hi,
I’ve read the ‘help’ documents and tinkered for a while but I can’t get this to work correctly.
Context:
One of our MATS applications is used to evaluate customer applications, successful applications are then POST to a 3rd party REST API for the final stage of processing.
Some customer data already exists in the 3rd party API prior to the MATS system going online, and some customer data is POST to the API outwith MATS.
The customer data in the API can be changed outwith MATS.
My point here is; there is not a one-to-one relationship between a record in MATS and the 3rd party API. Every successful applicant’s record in MATS has a record in the API, but not every record in the API will have an application record in MATS.
My goal:
Call the API each night in order to track changes to the customer records.
What’s not working:
I have an API Request object and an object for the Local Summary of API records.
An API call is configured with a base object of the Local Summary and the relation path is to the API Request object.
The “Request selection” is set to “none”, as the API call is independent to any specific record.
The “Action” is “Match else create”, as each night this should update the previous night’s record data, or create new Local Summary where there is a record in the API that doesn’t exist yet in MATS.
The response data is of the format below, where the data array can be any length from 0 to 200 items
{ “data”:[
{
“item_id”:“ABC1”,
“item_state”:“ACTIVE”,
“item_renewal_date”:“2019-09-24”
},
{
“item_id”:“ABC2”,
“item_state”:“CANCELLED”,
“item_renewal_date”:“2019-10-20”
},
{
“item_id”:“ABC3”,
“item_state”:“NEW”,
“item_renewal_date”:“2020-09-18”
}]}
The help documentation states that MATS will know to iterate on the data items.
I’ve tried creating the response body as per the help doc, but also tried using adding an API reponse template into the JSON response.
Neither do what I want.
How should I construct the response body to iterate on all data items received and “match else create” using the item_id?
For info what goes wrong is one of the following:
- Only the first data item is action-ed, and isn’t matched, a duplicate is created
- Using the template all data items are action-ed and created as new records. matching doesn’t work
- a new record is created for each property within data item 1.
Thanks
Craig