RESTful interfaces
Extending Swarm can be done in several ways. Modules are the primary mechanism for extending Swarm, but there are also RESTful interfaces for getting and setting state on objects in Swarm.
See the Swarm API chapter for more RESTful interface details.
Creating events in the activity feed
Swarm supports adding events from any other tool via a simple RESTful-ish
endpoint. Posts to /activity/add
with the following
options will be added to the event queue.
- type
-
required - type of activity, e.g. 'jira'
- user
-
required - user that performed the action
- action
-
required - post-tense action, e.g. 'created'
- target
-
required - label for target, e.g. 'issue 1234'
- description
-
optional - description of object or activity
- time
-
optional - time of activity (defaults to now)
- streams
-
optional - list of streams to display on
- link
-
optional - string URL of target
It is easy to post a Swarm event using curl. For example, warn your co-workers of the ever increasing threat of dingoes with:
$ curl --uuserid
:password
-H "Content-type: application/json" \ --d'{"type":"coffee","user":"A dingo","action":"ate","target":"a baby"}' \ http://myswarm
/api/v1/activity
Setting the test status for a code review
There are two end points to set the test status for a review:
/reviews/54321
/tests/pass /reviews/54321
/tests/fail
where 54321
should be replaced with the id of
the review in question.
Web services
A number of Swarm actions provide JSON formatted output or accept simple POST parameters to do updates.
See the Swarm API chapter for coverage of these endpoints.