### API Call Examples Source: https://developer.kyriba.com/portal-extension/documentation/Kyriba%20Documentation_page=%2FKyriba+Documentation%2FGlossary Examples of common API calls demonstrating HTTP request methods and endpoint structures. These examples illustrate how to interact with the Kyriba API for retrieving data or triggering actions. Note that these calls count towards daily limits. ```http POST https://{{host}}/gateway/oauth/token ``` ```http GET https://{{host}}/gateway/api/v1/accounts?page.limit=1000&page.offset=2000 ``` -------------------------------- ### Base URL Example for API Access Source: https://developer.kyriba.com/portal-extension/documentation/Kyriba%20Documentation_page=%2FKyriba+Documentation%2FGlossary An example demonstrating the structure of a Base URL for accessing Kyriba APIs. This URL serves as the foundation for API requests, with resource paths and query parameters appended to it. ```http {{baseUrl}}/v1/account-groups ``` -------------------------------- ### JSON Web Token (JWT) Example Source: https://developer.kyriba.com/portal-extension/documentation/Kyriba%20Documentation_page=%2FKyriba+Documentation%2FGlossary A JSON Web Token (JWT) is a compact data representation format defined by RFC 7519. It consists of a header, payload, and signature, separated by dots. The JWT structure can evolve without breaking changes, so its content should not be validated. ```text eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c ``` -------------------------------- ### POST /oauth/token - Retrieve Token Source: https://developer.kyriba.com/static/download/getting-started/access-token This endpoint is used to obtain an access token for authenticating API requests. It utilizes client credentials for authorization and supports the 'client_credentials' grant type. ```APIDOC ## POST /oauth/token ### Description Obtains an access token using client credentials. This token is required for authenticating subsequent API requests. ### Method POST ### Endpoint `{{tokenUrl}}` ### Parameters #### Query Parameters - **grant_type** (string) - Required - Must be `client_credentials`. - **scope** (string) - Optional - The scope of the access request. #### Request Body This endpoint uses `urlencoded` for the request body. - **client_id** (string) - Required - Your application's client ID. Provided via Basic Auth. - **client_secret** (string) - Required - Your application's client secret. Provided via Basic Auth. ### Request Example ```json { "grant_type": "client_credentials", "scope": "" } ``` ### Response #### Success Response (200) - **access_token** (string) - The obtained access token. - **token_type** (string) - The type of token, usually `Bearer`. - **expires_in** (integer) - The time in seconds until the token expires. #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "Bearer", "expires_in": 3600 } ``` ``` -------------------------------- ### Postman Collection Variables for Kyriba API Source: https://developer.kyriba.com/static/download/getting-started/access-token Defines environment variables for the Kyriba API, including base URLs for the platform and token endpoint, and a variable to store the obtained access token. These variables are crucial for dynamic request construction. ```json { "variable": [ { "key": "baseUrl", "value": "https://{{datacenter-platform}}/gateway/api" }, { "key": "tokenUrl", "value": "https://{{datacenter-platform}}/gateway/oauth/token" }, { "key": "access_token", "value": "", "type": "string" } ] } ``` -------------------------------- ### Postman Request Configuration for Token Retrieval Source: https://developer.kyriba.com/static/download/getting-started/access-token This configuration defines a Postman request to obtain an OAuth 2.0 client credentials token from the Kyriba API. It utilizes basic authentication with client ID and secret, and sends 'client_credentials' as the grant type. ```json { "name": "Get Token.", "event": [ { "listen": "test", "script": { "exec": [ "pm.collectionVariables.set('access_token',pm.response.json().access_token);" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "basic", "basic": { "password": "{{client_secret}}", "username": "{{client_id}}" } }, "method": "POST", "header": [], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "client_credentials", "type": "text" }, { "key": "scope", "value": "", "type": "text" } ] }, "url": "{{tokenUrl}}" }, "response": [] } ``` -------------------------------- ### Set Access Token in Postman Source: https://developer.kyriba.com/static/download/getting-started/access-token This script is designed to be used within the 'test' script section of a Postman request. It extracts the 'access_token' from the JSON response of a request and sets it as a collection variable for subsequent requests. ```javascript pm.collectionVariables.set('access_token',pm.response.json().access_token); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.