OpenAPI definition for the Web API

Hallo,

as stated in the sonar blog Sonar Web API V2 | Sonar (sonarsource.com) the contract is “described following the OpenAPI”.

I’ve been searching for an URL for the OpenAPI specification but didn’t succeed.

The only URL I managed to find was the following: ${SONAR_URL}/api/webservices/list

The content is a json structure, but this structure is not compatible with swagger/ openapi.

Is there and OpenAPI URL or converter to OpenAPI?

Kind regards,
Armin Sczuka

Hi Armin,

Perhaps $SONAR-URL/web_api_v2 is what you’re looking for?

 
HTH,
Ann

Hello Ann,

thanks for your tip. The V2 API seems to be the extension for the V1 API.

I was trying to search for a URL to a swagger or open api json definition. Something like OpenAPI Specification - Version 2.0 | Swagger in order to be able generate client code for the SonarQube in this case.

We are actually looking into realizing some kind of converter from the ${SONAR_URL}/api/webservices/list plus ${SONAR_URL}/api/webservices/response_example to a swagger.json in order to be able to generate client code for different languages (like go and python in our case).

Kind regards,
Armin

1 Like

Hi Armin
have you had any success in your tooling project.
I would be interrested in the same as you (OAS compliant spec file).

tx

FYI: https://next.sonarqube.com/sonarqube/api/v2/api-docs provides a OAS compliant file for the v2

1 Like

Hi @sczuka,

The endpoint you are looking for is: <your sq instance>/api/v2/api-docs. Please note that it might move in the future, this is why it is not yet clearly documented.

Cheers,
Aurélien

For references, here is my attempt at a short go program to extract and convert the webservices definition to an openapi spec file:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.