Pulling data from web via REST BPM

I had a similar issue when starting with REST from a BPM/client.
Easy to view not so easy to actually consume th returned data.
What worked best for me was using JToken to further split the parsed JSON.
How you define the breakdown is depending on the JSON response structure.
The below sample is in a get list uBAQ that is then run form a function so I can schedule it to refresh postcodes from our freight broker. This should make it Kinetic ready :wink:
Hope it helps

JObject o = JObject.Parse(consignmentResponse);
//Create JToken for Each Json Response Section
JToken errToken = o["errors"];
JToken objToken = o["object"];
       
// If Error section is blank, use object section to get Postcode details 
// Else show Error Message

int x = 0;
if (errToken.HasValues == false)  
{
  foreach(var xRow in o["object"])
  {
        
    string myDescription = (string)o["object"][x]["description"];
    var addressArray = myDescription.Split(',');
    string mySuburb = addressArray[0];
    string myPostcode = Regex.Replace(addressArray[1], @"\s", "");

2 Likes