SonarQube Web Api Changes from 6.0 to 6.4 - sonarqube

I was using "http://sonarserver:9000/api/resources?metrics=ncloc,bugs,vulnerabilities" to get the details of all the projects for sonar 6.0.
After upgrading to 6.4 this url does not work and I am not able to find the alternative for this under the web_api changes page.
Please let me know if anyone knows about an alternative to this.
Error: {"errors":[{"msg":"Unknown url : /api/resources"}]}

Per WebAPI documentation (embedded in your own SonarQube server, linked at the footer): api/resources/index is deprecated since 5.4 (i.e. a super long time ago).
The documentation even provides some guidance:
if you need one component with measures: api/measures/component
That will get you the measures you need for a given project. You can use other APIs to get the list of projects (e.g. api/components/search). See Web API docs for the full listing of possibilities.

Related

How can I get the open new issues, confirmed new issues, false positive new issues?

This is a screen where we configure our project, SonarQube shows new issues open, confirmed which is highlighted in yellow, I am using the SonarQube API in my application and want to dump the data to my DB. Accordingly I will create the report. But In Sonar Metrics document I do not find how could I get these value using API.
api/issues/search should get you all you need. Check out the documentation embedded in your SonarQube server (linked at the footer).
From the use-case you describe, parameters sinceLeakPeriod or createdAfter / createdInLast can help out with date filtering. Not to mention other filters like resolved and componentKeys. Exchaustive listing is in the WebAPI documentation.

SonarQube API Resources - deprecated

I've noticed the Resources have been deprecated in 5.4. We make heavy use of this api and could not find a replacement.
How is the functionality of this API being replaced?
To fetch projects, /api/components/search_projects can be used. Sample usage https://sonarqube.com/api/components/search_projects.
To get the list of all apis, you can use api/webservices/list.

REST API for getting project last analysis date?

How do I get a project's last analysis time (the one you can see in the dashboard) with the REST API of SonarQube?
I am working with SonarQube 4.5.6, but if it's only available on later versions I'd still be interested in how it is done.
[EDIT] API relevant since SonarQube v6.3: api/project_analyses/search
[EDIT] Relevant API for SonarQube LTS v5.6.x: api/projects?versions=true
And since you mention later versions, since SonarQube 5.2:
api/ce/component : get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project) (documentation)
P.S.: api/components/show can be used to get the component ID from the project key
P.S.2 : here's a real-life example on public SonarQube project. First get the component ID then query the component -> "submittedAt": "2016-03-07T06:04:31+0100" (slight difference with the dashboard value, due to the processing time on the scanner side)
You can use the Resources API : https://nemo.sonarqube.org/api/resources/index?metrics=date&format=json and look at the 'date' field to get the last analysis time.

How to add an application to Apache Brooklyn catalog

I am trying to add applications into Brooklyn catalog. can anyone explain steps to add a new application to catalog.xml?
I did try the sample catalog provided at https://brooklyn.incubator.apache.org/v/0.7.0-M1/use/guide/quickstart/policies-and-catalogs.html . The application gets listed in catalog tab but when I try to launch it, it gets stuck at 'configuring'. Is there something else that needs to be done ?
I tried adding existing application to catalog ( https://brooklyn.incubator.apache.org/v/latest/ops/catalog/index.html ) but it failed. Can anyone help me with this ?
I'd strongly recommend upgrading to 0.7.0-M2-incubating, as the catalog has significantly improved since 0.7.0-M1. The documentation at https://brooklyn.incubator.apache.org/v/latest/ops/catalog/index.html describes the steps for 0.7.0-M2-incubating; they will not work for 0.7.0-M1.
The link to an explicit version of the docs (rather than latest) is https://brooklyn.incubator.apache.org/v/0.7.0-M2-incubating/ops/catalog/index.html
There are also more improvements in snapshot (and in existing pull requests), if you fancy trying the bleeding edge!
For the 0.7.0-M1 error "gets stuck at configuring", we'd need more info (e.g. logs, etc). Suggest you e-mail the mailing list or jump on IRC if it's still a problem (https://brooklyn.incubator.apache.org/community/mailing-lists.html).

Codeigniter: Is DX_Auth outdated?

I tried installing DX_Auth in CI 2.1.0 and it's throwing errors everywhere. I took a look at some of the files and much of it is written for PHP 4. Should I be using a different auth library instead?
Things I noticed:
Uses Classname instead of __construct. However, this is easy to change
DX has a plugins folder while CI does not. Is this the equivalent of the *third_party* folder?
Also, there is no $this->load->plugin() which to load the DX plugin folder
Took a look at DX_Auth.php and saw it says (c) 2008. So...it hasn't been updated since 2008?
This is my first time using an Auth library. Should I be using a different library instead of DX_Auth?
Personally I have stuck to using Tank Auth and it is up to date IMHO.
Details are here: http://www.konyukhov.com/soft/tank_auth/
Also changelog etc; here: https://github.com/ilkon/Tank-Auth
Try ion_auth: http://benedmunds.com/ion_auth/
It is updated frequently and works correctly with latest version of CodeIgniter.
Few years back I used DX Auth. It worked great!
3 months ago, again I had to use authentication library in one of my (Code Igniter) projects. When I searched for DX auth, found very little information. Even I couldn't access their users manual that was well written. After searching for a while, I found the code on github. Now, I've Implemented it with CodeIgniter 3 without any issue. However, I stuck in some places due to lack of documentation. But it's not a big issue.
DX auth is getting a new refraction and upgrading the library, but still it isn't outdated, you can use the library functionality's without any issues.
Simply modify the Controllers and Models by adding a postfix CI_
DX Auth is now on GitHub

Resources