Highlighted
Super Contributor.. EvskiL Super Contributor..
Super Contributor..
1017 views

RestFul API - Scripting Requests

Jump to solution

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?

0 Likes
1 Solution

Accepted Solutions
Outstanding Contributor.. Tommy Jensen Outstanding Contributor..
Outstanding Contributor..

Re: RestFul API - Scripting Requests

Jump to solution

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))

 

View solution in original post

3 Replies
Outstanding Contributor.. Tommy Jensen Outstanding Contributor..
Outstanding Contributor..

Re: RestFul API - Scripting Requests

Jump to solution

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?

0 Likes
Super Contributor.. EvskiL Super Contributor..
Super Contributor..

Re: RestFul API - Scripting Requests

Jump to solution

Hi Tommy,

I am using just using Powershell

0 Likes
Outstanding Contributor.. Tommy Jensen Outstanding Contributor..
Outstanding Contributor..

Re: RestFul API - Scripting Requests

Jump to solution

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))

 

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.