Using the API - Authentication
When interfacing Signify'Signify’s API,API youuses willBearer requireToken aauthentication.
POST /identity/v1/CreateUserAccessToken
The call to CreateUserAccessToken returns an accessToken in the format Bearer eyJhbGciOi...
This token is valid for 24 hours and must be included in the Authorization header of all subsequent API requests.
Example response from CreateUserAccessToken
{
"clientId": "",
"accessToken": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
USAGE EXAMPLE
See Powershell example below to generate token and use it in a usagesubsequent exampleAPI in Powershell call
- 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
- accessToken is the bearer token and contains "Bearer {token}"
# generate access token
$headers = @{
"Content-Type" = "application/json"
}
$body = @{
username = "{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