- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 07:15 PM
I know calling a REST Api using REST Message API from Server Script using basic autorizaton model.
But the client specific requirement is, we should call the REST from client side (from service portal widget) and logged in user's authenticity need to be used for REST autorization.
Solved! Go to Solution.
- Labels:
-
Service Portal
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2017 10:35 AM
Hello Chandan,
I think below article may help you for calling Rest Service from Service Portal:
How to use a REST API with RESTMessageV2 in Service Portal.
Do let me know if that works for you.
Best Regards,
Jaikumar Haryani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2017 10:35 AM
Hello Chandan,
I think below article may help you for calling Rest Service from Service Portal:
How to use a REST API with RESTMessageV2 in Service Portal.
Do let me know if that works for you.
Best Regards,
Jaikumar Haryani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 01:01 AM
Hi Chandan,
You can add the following script in your Client script of Servicenow Portal:
function($http,$scope){
/*Calling a Rest API*/
var options = {
method: 'GET', // Get method to fetch data
url: 'https://httpbin.org/get',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
}
$http(options).then(function(response){
console.log(response);
});
}
from data, you will get the response.
You have to give HTTPS enabled REST url. If you give "HTTP" in spite of "HTTPS" then service now will encounter an error to console. Following :
So it is necessary to use HTTPS parameter.
Thank you.
If you feel that it is a correct answer then please make it as correct. Otherwise please let me know I will look into the matter again.