3rd Party REST API using import table and transform map

shellypoeckes
Tera Contributor

Hi All,

Kind a new at REST APIs.  Customer has given me an REST API to get records from their system.  Is there a way like using a soap web service where it creates import set, transform map vs getting everything out of JSON?  It would be great to use REST API and use the import set and transform map process.

 

Thanks.

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi,

You can break the json down in a script and then populate into an import table, or directly manipulate and insert\update your destination table.

I'd prefer the import table\scripted approach as processing is seperate and it's easier to manage data mapping and nested values.

// Initiate Get
var myRestGet = new sn_ws.RESTMessageV2();
myRestGet.setHttpMethod('get');
myRestGet.setEndpoint("Your URL");

// Grab the response
var response = myRestGet.execute();
var responseBody = response.getBody();

var myRecords = new global.JSON().decode(responseBody);

//Then you can iterate through the result and populate into import set
//Or tweak the *&^ out of the data and throw it straight into prod if it's your preference.

for(var i=0; i < myRecords.records.length; i++)    {

var newRec = new GlideRecord("your_table");
newRec.initalize();

your_table.fieldName = myRecords.records[i].fieldName;

// If you have nested resuilts in your json and are going straight into prod you will need to break them down here
// otherwise just throw the nested field into a big string field and worry about it in the import transform.

}

I am currently workjing on an integration and should be dealing with similar scenario in the next week +/-
So let me know how you get on.

 

 

 

 

 

 

View solution in original post

5 REPLIES 5

Hi Tony, me too I working in similar scenario integrating 3rd party data.

I adopted a solution based on a scripted rest operation like your, have you idea if that solution is eligible for Scoped App Certification?