API Call through powershell/vbs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 02:58 AM
Hello experts,
Is there an API Key/call we could use to pull data from Service now, specifically just tickets/incidents per user. Either via Powershell/vbs or PHP?
If it is possible can I have some links which could guide me in a proper direction?
Thanks
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 04:53 AM
For example:
# Eg. User name="admin", Password="admin" for this code sample.
$user = "admin"
$pass = "admin"
# Build auth header
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user, $pass)))
# Set proper headers
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Authorization',('Basic {0}' -f $base64AuthInfo))
$headers.Add('Accept','application/json')
# Specify endpoint uri
# Specify HTTP method
$method = "get"
{request.body ? "$body = \"" :""}}
# Send HTTP request
$response = Invoke-WebRequest -Headers $headers -Method $method -Uri $uri
# Print response
$response.RawContent