Migration Guide
This high-level guide will walk you through the steps required to migrate from the legacy deployments API to the new Raygun API.
Step 1: Create a Personal Access Token (PAT)
To begin using the new API, you'll need to create a Personal Access Token. This token will serve as your authentication mechanism when making requests to the API. The PAT will be required to have the deplopyments:write
scope in order to create deployments. Refer to the documentation here on how to generate a PAT.
Step 2: Update the Request Authentication
Raygun's API is secured using Bearer Authentication. After obtaining your PAT, update your request to include the PAT as the bearer token in the Authorization header. Refer to the documentation here for more information about authenticating with the API.
Basic authentication and token authentication (by a query string value) are not supported by the new API.
Step 3: Update the API Endpoint
The endpoint for creating deployments has changed in the Raygun API. Modify the URL of your request to: https://api.raygun.com/v3/applications/api-key/{paste_your_api_key_here}/deployments
. Remember to replace {paste_your_api_key_here} with the API key of your application. Note that some older API keys may contain reserved URL characters and must be encoded before it's included in the URL.
Step 4: Update the Request Body
scmType
previously allowed an empty string value. This is no longer the case.
One of the following values must be supplied or null:
- GitHub
- Bitbucket
- GitLab
- AzureDevOps
The following 2 changes are optional and not required but still recommended.
apiKey
is no longer required in the request body and can be removed as it is now included in the URL.
createdAt
has been deprecated and deployedAt
should be used instead. You may still use createdAt
. If both properties are specified deployedAt
will be preferred.
Troubleshooting
Be sure to check the response of the API request as it may contain useful debugging information.
Getting a 401 response
Ensure you have included your PAT in the Authorization header.
Getting a 403 response
Ensure your PAT has the deployments:write
scope and has not expired. You can update the current scopes of a PAT at any time but will need to regenerate it if you wish to change the expiry date.
Getting a 404 response
Ensure the user who created the PAT has access to the application which the deployment is being created for. If your API key contains any reserved URL characters (+, =, /, etc) be sure to encode these values before including the API key in the request URL.