This an an archived version of the documentation for SonarQube version 4.3 and below.
See https://docs.sonarqube.org/display/SONAR/Documentation for current functionality

Skip to end of metadata
Go to start of metadata

Table of Contents

Get a List of Properties

DescriptionGet a list of properties

URL

/api/properties

HTTP MethodGET
Format Responsesjson | xml

Security

Optional (to get secured properties)

Examples

Use CaseExample Request
Get the list of all the properties

GET http://nemo.sonarqube.org/api/properties/?format=json

Get the global property 'sonar.core.codeCoveragePlugin'

GET http://nemo.sonarsource.org/api/properties/sonar.java.coveragePlugin

Get the property 'sonar.core.codeCoveragePlugin' on project 'org.codehaus.sonar:sonar'

GET http://nemo.sonarsource.org/api/properties/sonar.java.coveragePlugin?resource=org.codehaus.sonar:sonar

 

(warning) If the property is not overloaded, the API will return a message like :

<error>
  <code>404</code>
  <msg>Property not found: sonar.java.coveragePlugin</msg>
</error>

 

Response Format

JSON
[
  {
    "key":"sonar.core.treemap.colormetric",
    "value":"violations_density"
  },
  ...
]

Parameters

Parameter

Description

Required

Default Value

Example Value

id

Key of the property

No

Get all properties if not set

sonar.core.codeCoveragePlugin

resource

id or key of the project

No

None

org.codehaus.sonar:sonar

format

Response format can be set through:

  • Parameter format: xml | json
  • Or the 'Accept' property in the HTTP header:
    • Accept:text/xml
    • Accept:application/json
Nojsonjson

Create or Update a Property

DescriptionCreate or update a property

URL

/api/properties

HTTP MethodPOST
Security

Requires Administer System permission

Examples

Use CaseExample Request
Create or update property 'myProperty' with value 'myValue' by user admin/admin

curl -u admin:admin -X POST http://localhost:9000/api/properties?id=myProperty&value=myValue

Example to create a property with the content of a file:

curl -u <login>:<password> -X POST http://localhost:9000/api/properties/?id=<key> -v -T <path/to/file>

Create or update property 'myProperty' with value 'myValue' by user admin/admin on project 'org.codehaus.sonar:sonar'

curl -u admin:admin -X POST http://localhost:9000/api/properties?id=myProperty&value=myValue&resource=org.codehaus.sonar:sonar

Example to create a property with the content of a file:

curl -u <login>:<password> -X POST http://localhost:9000/api/properties/?id=<key>&resource=org.codehaus.sonar:sonar -v -T <path/to/file>

Parameters

Parameter

Description

Required

Default ValueExample Value

id

Key of the property

Yes

NonemyProperty

value

Value of the property

Yes

NonemyValue

resource

id or key of the project

No

None

org.codehaus.sonar:sonar

Delete a Property

DescriptionDelete a property

URL

/api/properties

HTTP MethodDELETE
Security

Requires Administer System permission

Examples

Use CaseExample Request
Delete property 'myProperty' by user admin/admin

curl -u admin:admin -X DELETE http://localhost:9000/api/properties/myProperty

Delete property 'myProperty' by user admin/admin on project 'org.codehaus.sonar:sonar'

curl -u admin:admin -X DELETE http://localhost:9000/api/properties/myProperty?resource=org.codehaus.sonar:sonar

Parameters

Parameter

Description

Required

Default ValueExample Value

id

Key of the property

Yes

NonemyProperty

resource

id or key of the project

No

None

org.codehaus.sonar:sonar

  • No labels