Is there any possibility to obtain the version of a LIB used by a project (through web service) ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Is there any possibility to obtain the version of a LIB used by a project (through web service) ?

Michel Pawlak
This post has NOT been accepted by the mailing list yet.
Hi SQ team,

I'm trying to retrieve versions of dependencies of a project through SQ's webservices API. Everything works for BRC dependencies, but I cannot get the version when the qualifier is LIB.

Here is what I do:

/api/dependencies?resource=groupid%3Aartifactid-impl&dir=out

returns:

<deps>
<dep>
<id>2078794</id>
<fi>3612</fi>
<ti>3611</ti>
<u>provided</u>
<w>1</w>
<fk>
groupid:artifactid-impl
</fk>
<fn></fn>
<fq>BRC</fq>
<tk>
groupid:artifactid-api
</tk>
<tn></tn>
<tq>BRC</tq>
</dep>
...
<dep>
<id>2078862</id>
<fi>3612</fi>
<ti>238</ti>
<u>provided</u>
<w>1</w>
<fk>
groupid:artifactid-impl
</fk>
<fn></fn>
<fq>BRC</fq>
<tk>ch.qos.logback:logback-classic</tk>
<tn>ch.qos.logback:logback-classic</tn>
<tq>LIB</tq>
</dep>
...
</deps>

Then if I extract <ti>and call the resources webservice I get the following results:

For the BRC dependency:

/api/resources?resource=3611

Returns:

<resources>
<resource>
<id>3611</id>
<key>
groupid:artifactid-api
</key>
<name>groupid:artifactid-api</name>
<lname>groupid:artifactid-api</lname>
<scope>PRJ</scope>
<qualifier>BRC</qualifier>
<version>1.0.0-SNAPSHOT</version>
<date>2015-05-27T09:53:19+0200</date>
<creationDate>2015-04-02T11:27:21+0200</creationDate>
</resource>
</resources>

Which is great : I can the retrieve the <version>. However for the BRC dependency I get a HTTP 404 error :

/api/resources?resource=238

Returns:

<error>
<code>404</code>
<msg>Resource [238] not found</msg>
</error>

My questions are :

- Am I doing something wrong or is there any other way to retrieve the version information ?
- The library versions are kept in SonarQube's DB is there any reason for not allowing us to retrieve this information ?
- Is it the expected behavior or is it a bug ?
- Is there a way to write my own webservice to retrieve this information (if yes any information about where to start would be greatly appreciated.) ?

Thank you in advance !

Michel