1. Authorization Request: The client application initiates the authentication process by requesting authorization from the user. This typically involves redirecting the user to the Blackpearl Group Pearl Diver authorization endpoint and specifying the desired scopes, including
openid
,profile
,offline_access
.
Example Authorization Request (in your code, the actual URL and parameters may vary):
2. User Authentication: The user is presented with a login screen and is prompted to grant or deny access to their data. If the user grants access, they are redirected back to the client application's specified redirect URI with an authorization code.
Example Redirect URL:
3. Token Exchange: The client application exchanges the authorization code for an access token. This exchange is made directly with the Blackpearl Group Pearl Diver token endpoint.
Example Token Exchange Request:
In this request, the client provides the authorization code received in step 2, along with its client ID and client secret for authentication.
4. Access API: With a valid access token, the client application can now access the Blackpearl Group Pearl Diver REST API on behalf of the user. Include the access token in the
Authorization
header of your API requests.
Example API Request (using the access token):
5. Refreshing the Access Token: Access tokens may expire after a certain period. To maintain ongoing access without requiring the user to reauthenticate, the client can use the refresh token to obtain a new access token. This is done by making a request to the token endpoint with the refresh token.
Example Token Refresh Request:
The client provides the refresh token it obtained in step 3, along with its client ID and client secret. In response, it receives a new access token and, a new refresh token.
Remember to store the new access token and, the new refresh token securely for continued API access. The use of refresh tokens allows your application to maintain access without user intervention even when access tokens expire.
Absolute Lifetime: Set a refresh token or refresh token family lifetime after which the user must re-authenticate before being issued a new access token.
Lifetime | 31,557,600 seconds (1 year) |
Inactivity Lifetime: Set the inactivity lifetime of issued refresh tokens to expire if the user is not active in your application during a specified period.
Lifetime | 2,592,000 seconds (30 days) |
GET List AudiencesReturns all Audiences for an account Permissions required: Authenticated RequestHeaders Content-Type: application/json The API only responds with JSON payloads Accept: application/json The API only accepts JSON body requests Authorization: Bearer token REQUIRED Path parameters No path parameters Query parameters No query parameters Responses200 OK Returned if the requested audiences are returned. application/json AudienceArray Properties audiences array<Audience> REQUIRED Child properties key integer REQUIRED name string. REQUIRED 400 Bad Request Returned if the audience list could not be returned. |
|
GET Get AudienceReturns an audience. This includes information about the audience and the corresponding record data set. Permissions required: Authenticated RequestHeaders Content-Type: application/json The API only responds with JSON payloads Accept: application/json The API only accepts JSON body requests Authorization: Bearer token REQUIRED Path parameters audienceKey: integer REQUIRED The key of the audience to be returned Query parameters range: integer OPTIONAL The period in days that the data will be retrieved against. If the range parameter is not specified, record data for 90 days will be returned. Default: 90 Minimun: 1 Maximum: 90 since: datetime OPTIONAL The datetime stamp that the data will be retrieved from. Cannot be used in combination with range parameter. If the range and since parameters are not specified, record data for 90 days will be returned. Default: date time 90 days ago Maximum: date time 90 days ago Format: ISO 8601 pageToken string OPTIONAL The token for the next page of record data of the given audience. If the pageToken parameter is not specified, up to the first 1000 record data items will be returned. The pageToken can be retrieved from the payload of the first and subsequent audience request that has more the 1000 data records. Responses
|
200 Response
|