How to import data of using Microsoft Graph API data source and flow designers

Shariq Azim
Kilo Guru

Hello  Experts,

I would like to ask how can we define the configurations particularly for Microsoft graph API to fetch and import data into our system.

Unfortunately, we cannot use spokes here neither is supported in any spokes (as i understood so far).

So things that i have tried so far:

 

Create Data source

find_real_file.png

 

2. Create flow designer action to match it

 

find_real_file.png

 

3. credential inside the alias.

 

Just an info, the same oauth 2.0 credential will work if i put inside the legacy REST messages 

find_real_file.png

find_real_file.png

But unfortunately, neither i can confirm if this is  working or can confirm if this is configured properly for this flow designer setup.

on doing test load

find_real_file.png

 

Requesting to provide some guidances here what could be missing .

 

Thank you,

Regards,

Shariq

1 ACCEPTED SOLUTION

Shariq Azim
Kilo Guru

Alright, so the way i was able to resolve is by

Step 1:making the connection alias having a correct related oauth 2.0 credentials only and then removing the 'code' parameter from my rest action(this might be different in your infrastructure). and publish the changes

Step 2: changing the format to custom (parse by script). and using the following code:

    var parser = new JSONParser();
    var lineObj = parser.parse(line);
    var item = lineObj.value; //suited my API response and could be different for you
    for (var i = 0; i < item.length; i++) {
        if (item[i].hasOwnProperty('groupTypes') {
            var currentObj = item[i];
            var currentGroupName = (currentObj['displayName']).trim();
            var resultObj ={};
            resultObj.currentGroupName = currentGroupName; // this components could be different for you
            resultObj.alias = currentObj['mail'];
            resultObj.correlation_id = currentObj['id'];
            resultObj.short_description = currentObj['description'];
            result.addRow(resultObj);// making sure this line is present for every record that you want to create in import set table

        }
    }

View solution in original post

2 REPLIES 2

Shreya Shah
ServiceNow Employee
ServiceNow Employee

I would suggest you to create a custom spoke and implement actions for those endpoints that you want from the Microsoft Graph API as data stream actions and then use Integration Hub import to schedule these imports.

BTW what all endpoints other than DL are you looking to automate and import?

Shariq Azim
Kilo Guru

Alright, so the way i was able to resolve is by

Step 1:making the connection alias having a correct related oauth 2.0 credentials only and then removing the 'code' parameter from my rest action(this might be different in your infrastructure). and publish the changes

Step 2: changing the format to custom (parse by script). and using the following code:

    var parser = new JSONParser();
    var lineObj = parser.parse(line);
    var item = lineObj.value; //suited my API response and could be different for you
    for (var i = 0; i < item.length; i++) {
        if (item[i].hasOwnProperty('groupTypes') {
            var currentObj = item[i];
            var currentGroupName = (currentObj['displayName']).trim();
            var resultObj ={};
            resultObj.currentGroupName = currentGroupName; // this components could be different for you
            resultObj.alias = currentObj['mail'];
            resultObj.correlation_id = currentObj['id'];
            resultObj.short_description = currentObj['description'];
            result.addRow(resultObj);// making sure this line is present for every record that you want to create in import set table

        }
    }