Guidance for using Java to access the new Web API v2

Hi there :wave:

Could someone, maybe, share her/his point of view about the following? It would be great to get some insights up front.

I am trying to assess, if i can or should stick with sonar-ws library or if i should invest into generating an api-client for web-api-v2 as a java-library on premise.

I was made aware of blog-post: Introducing the new Sonar Web API V2

Currently, most of the time, i use sonar-ws library to programmatically access the WebApi of a Sonarqube Server Instance.

In the blog-post OpenAPI was mentioned together with the possibility to generate clients for many languages. We are using this in different contexts already, too. But i am not that versed in utilizing this kind of pipeline to re-generate my api-client.

cheers
Daniel

1 Like

Hi @daniel,

Thanks for your message.

You can use sonar-ws to access most V1 endpoints. However, this library is not maintained anymore and some recent features provided by the V1 are not available in sonar-ws.

As described in the blog post, endpoints will be gradually migrated to V2. From an OpenAPI schema, you can generate a client (for instance using openapi-generator).

Hope this helps,

Aurélien