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 Events

DescriptionGet a list of events from a project

...

URL

/api/events

HTTP MethodGET
Response Formatsjson | xml

Security

Requires User role to get the list of events for a specific project

...

Examples

Use CaseExample Request
Get all the versions from project Sonar (key = org.codehaus.sonar:sonar)

GET http://nemo.sonarsource.org/api/events?resource=org.codehaus.sonar:sonar&categories=Version

Get all the versions and alerts from project Sonar (key = org.codehaus.sonar:sonar) between January 1st, 2012 and August 31st, 2012

GET http://nemo.sonarsource.org/api/events?resource=org.codehaus.sonar:sonar&categories=Alert,Version&fromDate=2012-01-01&toDate=2012-08-31

Get global events from October 8th, 2012

GET http://localhost:9000/api/events?fromDate=2012-10-08

Response Format

Code Block
titleJSON
languagejavascript
[
  {
     "id":"573318",
     "rk":"org.codehaus.sonar:sonar",
     "n":"3.3-SNAPSHOT",
     "c":"Version",
     "dt":"2012-10-05T22:15:38+0000"
  },
  ...
]

...

Get global events if not set

Parameter

Description

Required

Default Value

Example Value

resource

id or key of the project

No

Yes

None

org.codehaus.sonar:sonar

categories

Comma-separated list of category filters (case-sensitive)

No

None

Version,Alert

fromDateTime

ISO-8601 datetime (inclusive)

No

None

2010-12-25T23:59:59+0100

toDateTime

ISO-8601 datetime (inclusive)

No

None

2010-12-25T23:59:59+0100

fromDate

Date (inclusive)

No

None

2010-12-25

toDate

Date (inclusive)

No

None

2010-12-25

formatResponse format.
Possible values: xml | json
NoNonejson

Create an Event

DescriptionCreate an event

URL

/api/events

HTTP MethodPOST
Security

Requires Project Administrator role

Examples

Use CaseExample Request
Create an event on project Sonar (key = org.codehaus.sonar:sonar) with administrator admin/admin:
  • Category: Alert
  • Name: myAlertName
  • Description: myAlertDescription

curl -u admin:admin -d "resource=org.codehaus.sonar:sonar&category=Alert&name=myAlertName&description=myAlertDescription" http://localhost:9000/api/events

Parameters

Parameter

Description

Required

Default Value

Example Value

resource

id or key of the project

Yes

None

org.codehaus.sonar:sonar

category

Event category

Yes

None

Alert 

name

Event name

YesNoneabc

description

Event description

NoNoneblabla