Integrator-Processing unknown JSON fragments

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
ColinP
Posts: 6
Joined: Wed May 02, 2018 7:40 pm
Location: UK

Integrator-Processing unknown JSON fragments

Post by ColinP » Wed May 02, 2018 8:33 pm

Hi All
I have been using Lansa for about 10 years; mostly to produce intranet websites using WAMS. I am currently using Lanas v13SP2. I have been using Lansa Integrator for about 6 months and have had a lot of success with some basic RESTful web services sending a receiving some straightforward JSON data.

I have now come across a few JSON responses from one of our Business partners that I am unsure how to process in Integrator. The Lansa UK support have recommended I post the question to this forum.

Example JSON response from our business partners ‘forms submitted’ API (a list of the details users have entered into various forms they have filled in on a mobile app):
[{
"Id": "8549630d-6a6a-4daa-83a5-df59eeed34b4",
"FormTemplateId": "CollectionForm",
"SubmissionTime": "2018-04-10 10:33:26",
"DriverId": "1222326969",
"JobID": "04cd2f9b-8e3d-4f7e-b927-510481f62a7d",
"CustomerId": "1155984567",
"Values": {
"753": {
"Id": "753",
"Name": "Collection Name",
"Value": "London Customer",
"Type": "input"
},
"259": {
"Id": "259",
"Name": "Collection Address",
"Value": "HIGH STREET, LONDON, UK",
"Type": "input"
},
"260": {
"Id": "260",
"Name": "Collection Town",
"Value": "LONDON",
"Type": "input"
},
"357": {
"Id": "357",
"Name": "Vehicles Details",
"Value": "AA12ABC",
"Type": "input"
},
"3": {
"Id": "3",
"Name": "Customer Name",
"Value": "Joe Blogs",
"Type": "input"
}
}
},{
"Id": "c21fdf3f-66d1-4aea-857b-47d1718eea22",
"FormTemplateId": "EstimatedArrivalTime",
"SubmissionTime": "2018-04-10 12:04:36",
"DriverId": "1222326969",
"JobID": "04cd2f9b-8e3d-4f7e-b927-510481f62a7d",
"CustomerId": "1155984567",
"Values": {
"2": {
"Id": "2",
"Name": "Expected Arrival Date",
"Value": "10/04/2018",
"Type": "input-date"
},
"3": {
"Id": "3",
"Name": "Expected Arrival Time",
"Value": "12:04",
"Type": "input-time"
}
}
}]

My question is how do I set up Lansa/Integrator so I can read the fragments within the "values" fragment? The names of the fragments "753", "259". "260" etc. are unknown to me because they indicate a unique field ID on the form that the user has filled in and submitted. There are many forms with many fields so there will be a huge number of field ids I will need to cater for.
So after I get to the "Values" fragment is there a way of saying something like "GET FRAGMENT(*NEXT) SERVICE_EXCHANGE(*FIELD)" (e.g. not having to specifically set up an Integrator fragment for "753", "259". "260" etc.) because all the fragments within the "Values" fragment all have the same structure?

Thanks in advance
Colin

ColinP
Posts: 6
Joined: Wed May 02, 2018 7:40 pm
Location: UK

Re: Integrator-Processing unknown JSON fragments

Post by ColinP » Mon May 21, 2018 6:50 pm

Hi
Sorry to bump this post but the project I am working on is getting near to the delivery deadline.
I was just wondering if anybody had come across this situation before and how they solved this issue? or if Integrator simply does not allow for this situation?
Thanks in advance
Colin

soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Re: Integrator-Processing unknown JSON fragments

Post by soa » Tue May 22, 2018 8:02 am

It is possible that LI cannot handle this situation. I would look at LANSA's new HTTP & JSON functionality which is much less restrictive. If you search for json on this forum you will find several examples. I have changed REST type function from LI to use these new services and it's pretty quick and easy.

Post Reply