Table of Contents
REST API Wrappers for V1 Compatibility
Updated
by Jennifer Trower
Read Time: 2 mins
While Sonar V2 uses GraphQL as its primary API language, rather than REST endpoints, many APIs that were available in Sonar V1 have been ported to V2 for backwards-compatibility purposes.
To see a list of all V1 endpoints, visit legacy.sonar.software/apidoc. There is also a subset of those V1 endpoints that are available in the current version of Sonar, which are listed below.
Sonar V2 Supported Endpoints
Category | Index | Show | Create | Update | Delete |
Testing the API wrapper
This cURL example assumes the username is apiguy and the password is superSecret123:
- bash/zsh/etc example (e.g., Linux or Mac):
API_URI=https://myinstance.sonar.software/api/v1/system/services
API_USER=apiguy
API_PASSWORD='superSecret123'
curl --basic --user "$API_USER":"$API_PASSWORD" $API_URI - Windows cmd/PowerShell:
curl.exe --basic --user apiguy:"superSecret123" https://myinstance.sonar.software/api/v1/system/services
Authenticating via Base64 username+password
If you’re using software you have written yourself, you may need to convert the username and password into an http basic authentication string. To do this, concatenate username:password. For example, if your username is apiguy and your password is superSecret123, convert apiguy:superSecret123 to base64 encoding. You can paste them below and we will do it for you. Note that nothing is transmitted to our server--this runs in your own web browser only.
Username: Password: