Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
iconfalse
titleTable of Contents

Table of Contents
maxLevel1

Get a List of Profiles

DescriptionGet a list of profiles

URL

/api/profiles/list

HTTP MethodGET
Response Formatsjson

Security

None
Available sinceSonar Version 3.3

Examples

Use Case

Example Request

Get all the profiles

GET http://nemo.sonarsource.org/api/profiles/list

Get all the java profiles

GET http://nemo.sonarsource.org/api/profiles/list?language=java

Get all the profiles used by project org.codehaus.sonar:sonar

GET http://nemo.sonarsource.org/api/profiles/list?project=org.codehaus.sonar:sonar

Get the java profile used by project org.codehaus.sonar:sonar

GET http://nemo.sonarsource.org/api/profiles/list?project=org.codehaus.sonar:sonar&language=java

Response Format

Code Block
titleJSON
languagejavascript
[
  {
    "name":"Sonar way with Findbugs",
    "language":"java",
    "default":false
  },
  {
    "name":"Sonar way",
    "language":"java",
    "default":false
  },
  ...
]

Parameters

Parameter

Description

Required

Default Value

Example Value

language

Profile language

No

None

java

project

Project key or id

No

None

org.codehaus.sonar:sonar

format

Response format can be set through:

  • Parameter format: json
  • Or the 'Accept' property in the HTTP header:
    • Accept:application/json
If nothing is set, json is used.
NoNonejson

Get Coding Rules Activated in a Quality Profile

...

DescriptionBackup a quality profile

URL

/api/profiles/backup

HTTP MethodGET
Response Formatsjson | xml
Security

Requires Global Administrator role

Available sinceSonar Version 3.1

Examples

Use CaseExample Request
Backup the default java quality profile

GET http://localhost:9000/api/profiles/backup?language=java

Backup the java quality profile 'Sonar%20way'

GET http://localhost:9000/api/profiles/backup?language=java&name=Sonar%20way

...

DescriptionRestore a quality profile backup

URL

/api/profiles/restore

HTTP MethodPOST
Security

Requires Global Administrator role

Available sinceSonar Version 3.1

Examples

Use CaseExample Request
Restore a quality profile from a backup

curl -X POST -u admin:admin -F 'backup=@backup.com' -v http://localhost:9000/api/profiles/restore

...

DescriptionDelete a quality profile

URL

/api/profiles/destroy

HTTP MethodPOST
Security

Requires Global Administrator role

Available sinceSonar Version 3.3

Examples

Use CaseExample Request
Delete the java quality profile 'Sonar way'

curl -u admin:admin -d "language=java&name=Sonar way" -X POST http://localhost:9000/api/profiles/destroy

...

DescriptionDelete a quality profile

URL

/api/profiles/set_as_default

HTTP MethodPOST
Security

Requires Global Administrator role

Available sinceSonar Version 3.3

Examples

Use CaseExample Request
Set the java quality profile 'Sonar way' as default

curl -u admin:admin -d "language=java&name=Sonar way" -X POST http://localhost:9000/api/profiles/set_as_default

...