Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

Early access:
Our REST APIs are set to change in the coming months, and we probably won't be maintaining the legacy endpoints .Moreover, we are currently using the OAuth 2.0 Password Grant as a temporary authentication strategy while we develop Personal Access Tokens which will improve the securityfor very long.

So, if you use our REST APIs, be ready to update your integrations!

...

  • Create a Requirement Yogi account.

  • Link an Atlassian account to your Requirement Yogi account.

  • Obtain an Generate a personal access token.

Create an account

...

  • Go to https://id.atlassian.com.

  • Log in to your Atlassian account.

  • In the top navigation bar, click the profile button.

  • Navigate to Account settings.

  • In the top navigation bar, navigate to Connected apps.

  • Locate the Requirement Yogi integration app.

  • Click the Remove access button.

...

Generate a personal access token

To obtain an generate a personal access token:

  • The response will contain:

    • access_token: the new access token

    • expires_in: the expiration delay of the new access token (in seconds)

    • refresh_token: the new refresh token

    • refresh_expires_in: the expiration delay of the new refresh token (in seconds)

  • Send a POST request Go to https://authapp.requirementyogi.com/realms/ry-cloud/protocol/openid-connect/token with the following information:

    • Headers:

      • Content-Type: application/x-www-form-urlencoded

    • Data:

      • client_id: backend-client

      • grant_type: password

      • username: the email address of your Requirement Yogi account

      • password: the password of your Requirement Yogi account

Code Block
languagebash
curl -L 'https://auth.requirementyogi.com/realms/ry-cloud/protocol/openid-connect/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=backend-client' \
-d 'grant_type=password' \
-d 'username=YOUR_EMAIL' \
-d 'password=YOUR_PASSWORD'
  • If the request is successful, you will receive a response that looks like this:

Code Block
languagejson
{
    "access_token": "YOUR_ACCESS_TOKEN",
    "expires_in": 300,
    "refresh_expires_in": 1800,
    "refresh_token": "YOUR_REFRESH_TOKEN",
    "token_type": "Bearer",
    "not-before-policy": 0,
    "session_state": "f4c9edf6-855c-4493-9da8-d0939269d0f5",
    "scope": "email profile"
}
  • The response will contain:

    • access_token: the access token

    • expires_in: the expiration delay of the access token (in seconds)

    • refresh_token: the refresh token

    • refresh_expires_in: the expiration delay of the refresh token (in seconds)

Refresh the access token

When the access token expires, you can use the refresh token to obtain a new access token:

Code Block
languagebash
curl -L 'https://auth.requirementyogi.com/realms/ry-cloud/protocol/openid-connect/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=backend-client' \
-d 'grant_type=refresh_token' \
-d 'refresh_token=YOUR_REFRESH_TOKEN'
  • If the request is successful, you will receive a response that looks like this:

Code Block
languagejson
{
    "access_token": "YOUR_NEW_ACCESS_TOKEN",
    "expires_in": 300,
    "refresh_expires_in": 1800,
    "refresh_token": "YOUR_NEW_REFRESH_TOKEN",
    "token_type": "Bearer",
    "not-before-policy": 0,
    "session_state": "3b2a9f95-1521-4cf8-a3ac-36e1aa01c36c",
    "scope": "email profile"
}
  • If the refresh token has expired, you need to request a new access token using your credentials .

  • Log in to your Requirement Yogi account.

  • In the top navigation bar, click the profile button.

  • Navigate to Settings.

  • In the left sidebar, navigate to Personal access tokens.

  • Click the Generate new token button.

  • Choose a descriptive to name to identify the personal access token.

  • Choose the expiration of the personal access token.

  • Click the Generate button.

  • Make sure to copy the personal access token.

  • For security reasons, it will never be shown again.

Make calls to the REST APIs

  • Choose the endpoint you want to use.

  • Add a X-Base-URL header to your request containing the base URL of your Atlassian site (e.g. https://example.atlassian.net/wiki for a Confluence instance, https://example.atlassian.net for a Jira instance).

  • Add an Authorization a X-Api-Key header to your request containing the your personal access token prefixed with Bearer (e.g. Bearer YOUR_ACCESS_TOKEN).

  • Send the request:

Code Block
languagebash
curl -L 'https://confluence.requirementyogi.com/rest/search?query=&limit=200&offset=0&spaceKey=SPACE' \
-H 'X-Base-URL: https://example.atlassian.net/wiki' \
-H 'AuthorizationX-Api-Key: Bearer YOUR_ACCESS_TOKEN'