In order to make requests into the CI/CD APIs, you have to generate an API key, which you use to generate a token, and then you can setup any kind of integration that you would like to make authenticated requests into the Blu CI/CD APIS.
Generate an Auth Token
After clicking encode, you should see a long string in the window below like this one:
QkxVLWJiNGJmNWU3LWY4ZGEtNDE5OC04Nzg3LWI4YjhiNjkyNDNiYTp4cjZrMzY5Y2RkOUVNcVhpWUd5elQyRUp6SW40MEkwbGxwWElNdVN1bWVrQkxVLWJiNGJmNWU3LWY4ZGEtNDE5OC04Nzg3LWI4YjhiNjkyNDNiYTp4cjZrMzY5Y2RkOUVNcVhpWUd5elQyRUp6SW40MEkwbGxwWElNdVN1bWVrQkxVLWJiNGJmNWU3LWY4ZGEtNDE5OC04Nzg3LWI4YjhiNjkyNDNiYTp4cjZrMzY5Y2RkOUVNcVhpWUd5elQyRUp6SW40MEkwbGxwWElNdVN1bWVrQkxVLWJiNGJmNWU3LWY4ZGEtNDE5OC04Nzg3LWI4YjhiNjkyNDNiYTp4cjZrMzY5Y2RkOUVNcVhpWUd5elQyRUp6SW40MEkwbGxwWElNdVN1bWVr
. Copy that string, as you will use it to make authenticated requests into the BluBracket APIs.Create an API key by navigating to Settings > API Keys
Enter a name for the key
Select
Integration
from the drop downSelect
Generate Key
Save the JSON/CSV file to your desktop
Open the JSON/CSV file and copy the value of the token
{ "api_keys": { "https://mycompany.blubracket.com": { "id": "BLU-a492144b-f118-4598-991e-f1d4d6209edf", "key": "TofsB.....EqwGg", "token": "QkxVL....xd0dn" } } }
With that token, you can make requests directly into the APIs. You will need to set the
Authorization
header and use the provided token as Bearer token.Here are some examples using curl.
curl -H "Authorization: Bearer TOKEN_FROM_STEP_4" http://mycompany.blubracket.com/api/analyzer/commit/scan/fd974b65-61ba-4576-849a-0e6aa1fdd16b
CI/CD API Reference Material
CI/CD
Resource | Parameters | Response | |
---|---|---|---|
Description | Code | Response | |
Start a scan for a list of commits or a pull request. The scan_uuid returned in the response can be used to query the result once it’s ready. | Body:
Either commit_shas or pull_request_number must be specified. Examples: { "repo_url": "https://github.com/my_org/my_repo", "commit_shas": ["a20cb4ca5c14ff27bdf16989d450c83b22f156d8", "d0d6593d1d4e81acd073244f42b6893fa65c99d8"] } { "repo_url": "https://github.com/my_org/my_repo", "pull_request_number": 3891 } | 200 | Example: { "scan_uuid": "fd974b65-61ba-4576-849a-0e6aa1fdd16b" }
|
Get the result of the scan with id= |
| 200 | The secrets found in the commits/pull request. Details of the secrets can be queried in the portal using Example: { "secrets": { "067a541e8274c9c5ddded6efb9de2645f09d4175": { "secrets_found": [ { "secret_hash": "mzS+LrmAX6iHcISmA6PrAi/yb3n10K2F2u/UcSdra3c", "secret_type": "slack_legacy_token" } ] }, "ecacd046e4dbf12acd619364235ce6f888d05276": { "secrets_found": [ { "secret_hash": "IELRaL7zfl3U68yJBkS6d1aPjMZuR0hh/z4cexc8Pbg", "secret_type": "password_assignment" } ] } } } |
202 | The scan is still in progress. |
Comments
0 comments
Please sign in to leave a comment.