API Token triggers error 400 on Jira Align Connector
Summary
Users can utilize the Jira Align API through various platforms such as Swagger and Postman or even through scripts that are written in different programming languages, including but not limited to Python.
The process of creating the API token takes place within the Jira Align system. The characters for this token are generated randomly, and they may include special characters, with the sole exception being quotation marks.
This particular method of generation means that it is entirely possible for an API token to contain a slash (/). This could cause issues and break the API call when it is being used through scripts. This is because, within a string, a slash can often be interpreted as indicating commands.
Solution
There are two possible solutions for that:
Recreating a new API Token:
To create a Jira Align API Token, follow these steps:
Log in to your Jira Align account.
Click on your profile icon in the top right corner of the screen.
From the dropdown menu, select 'Profile'.
go to the 'API Tokens' section on the Profile page.
Click on the 'Create New Token' button.
You will be prompted to enter a name for the token. This can be anything you like, but it's best to make it descriptive so you can remember what it's for.
Click 'Create'.
Your new token will be displayed. Make sure to copy it and store it somewhere safe, as you won't be able to see it again.
You can now use this token to authenticate your API requests.
Fixing the string in Python
To use the slash as a character in the string in Python, we should use "//".
Example:
API TOKEN = user:999999|w~h<1p7Fj$z]tR@F&qT7bUeF/0Y[1tN{hmqP2E;T
To use the API token below with a slash, we should use a string like the following:
API_TOKEN = 'user:999999|w~h<1p7Fj$z]tR@F&qT7bUeF//0Y[1tN{hmqP2E;T'