When using the babelforce API, there are multiple ways to authenticate. There is an easy but not recommended way and there is a secure way. We'll walk you through both and give our recommendation on what to do, best.
We will start with the recommended way, creating an oauth token via user name and password. Then you will be introduced to using Access ID and Access Token.
Using oauth token
- You need the username and password of a user with manager rights
- You then run this command to fetch the token:
-
curl --location --request POST 'https://{{env}}.babelforce.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username={{my@email.org}}' \
--data-urlencode 'password={{myP@ssword3483}}' \
--data-urlencode 'grant_type=password'
-
- You can now access all manager resources
- Example: Getting all available agents:
-
curl --location --request GET 'https://{{env}}.babelforce.com/api/v2/agents' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{mytoken}}' \
--data-raw ''
-
Using Access ID and Access Token
- First, log into babelforce manager and go to this page:
-
https://apps.{{env}}.babelforce.com/manager/manager/account/overview
- As always, replace the {{env}} if needed. For the main EU region, no environment name is needed
- Find the Access ID and Access Token there:
-
- This is how you would use these in your curl to get all agents:
-
curl --location --request GET 'https://{{env}}.babelforce.com/api/v2/agents' \
--header 'X-Auth-Access-Id: {{yourAccessID}}' \
--header 'X-Auth-Access-Token: {{yourAccessToken}}' \
--header 'Content-Type: application/json' \
--data-raw ''
-
Comments
0 comments
Please sign in to leave a comment.