Using the API - Authentication
When interfacing Signify's API, you will require a bearer token.
See below a usage example in Powershell
- Generate access token
- {username} - Signify supplied username
- {password} - Signify supplied password
- {clientId} - a unique GUID identifying the ruleset you are logging into
- {apiendpoint} - the endpoint where the system is installed e.g. https://uat.signifyhr.co.za/api
- Example calling ListUsersExport
- accessToken is the bearer token and contains "Bearer {token}"
# generate access token
$headers = @{
"Content-Type" = "application/json"
}
$body = @{
username = "{username]"
password = "{password}"
clientId = "{clientId}"
} | ConvertTo-Json
$tokenResponse = Invoke-RestMethod `
-Uri "{apiendpoint}/identity/v1/CreateUserAccessToken" `
-Method POST `
-Headers $headers `
-Body $body
# Example usage calling ListUsersExport
$headers = @{
Authorization = "$($tokenResponse.accessToken)"
"Content-Type" = "application/json"
}
$body = @{
usernames = @()
} | ConvertTo-Json -Depth 3
$response = Invoke-RestMethod `
-Uri "{apiendpoint}/jobprofilerapi/v1/ListUsersExport" `
-Method POST `
-Headers $headers `
-Body $body
$users = $response.users | ConvertTo-Json -Depth 10