Service Manager / Service Center Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

RestFul API - Scripting Requests

SOLVED
Go to solution
Highlighted
EvskiL
Regular Collector

RestFul API - Scripting Requests

Hi All,

I am looking WebServices as a way to monitor our various Queues for each assignment group.

My issue is that I am writing a script to query every so often to get the most up to date information, but I cannot authenticate the WebServices GET requests.

http://servicemanager.com:13080/SM/9/rest/incidents?status=open&assignment=Service Desk

Is there a way to add my username and password onto the URL to authenticate my request?

3 REPLIES
Tommy Jensen
Esteemed Contributor

Re: RestFul API - Scripting Requests

Not to my knowledge. But the programming language you use have methods to add basic authentication to your request.

What language are you coding in?

EvskiL
Regular Collector

Re: RestFul API - Scripting Requests

Hi Tommy,

I am using just using Powershell

Tommy Jensen
Esteemed Contributor
Solution

Re: RestFul API - Scripting Requests

Then you need something like this (this example is for servicenow so you may need to tweak). I did not write this so can't answer specific questions about this..

 

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user, $pass)))
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Authorization',('Basic {0}' -f $base64AuthInfo))

 

//Add this to "OnDomLoad" event