agilemanager-api
HPE's Agile Manager client API module for NodeJS
Example Use Case: Dashboard
Easily integrate with Agile Manager to create your very own dashboard UI:
Install
npm install agilemanager-api
Setup
Prepare an options object with clientId and clientSecret keys from Agile Manager's configuration area:
var options = {
clientId: 'api_client_0000000_0',
clientSecret: 'lknNSDASY6458ub'
};
Require the agilemanager-api
npm module after it was installed and instantiate the object with the prepared options:
var AGM = require('agilemanager-api');
var agm = new AGM(options);
login
Example
Perform an AGM login
method to authenticate the API and continue working with the rest of the methods available
agm.login(function (err, body) {
});
query
Example
Perform an AGM agm.query(fn)
method on any type of resource.
The agm.query(fn)
method expects an object with the following members:
- workspaceId - the workspace id in AGM
- resource - the resource type, can be any one of the listed resources
- query - the actual query to perform, accepting statements with ; char as a logical AND and || as logical OR
- fields - a list of specific fields to be filtered in the returned response
- orderBy - a field to order the results, by default results are of ascending order or with a prefix - symbol for decesending results (for example:
fields: -name
) - limit and offset - both of these options allow to specify numbers for the purpose of paginated results
For example, to query for a list of backlog items, with id bigger than 2000, and getting back only the name field in the JSON response:
var queryOptions = {
workspaceId: '1000',
resource: 'backlog_items',
query: 'id>2000',
fields: 'id,name',
orderBy: 'name',
limit: 10,
offset: 0
};
agm.query(queryOptions, function(err, body) {
});
resources
Example
Using the agm.resources(fn)
method it's possible to perform CRUD operations directly on any type of supported resources.
Example of creating a user story:
var resourceOptions = {
workspaceId: '1000',
resource: 'backlog_items',
method: 'POST',
data: [{
name: 'New user story',
subtype: 'user_story'
}]
};
agm.resource(resourceOptions, function(err, body) {
});
Example of deleting a user story
Example of creating a user story:
var resourceOptions = {
workspaceId: '1000',
resource: 'backlog_items',
method: 'DELETE',
entityId: '1945'
};
agm.resource(resourceOptions, function(err, body) {
});
Agile Manager API Usage
RESTful API
Agile Manager's API is RESTful and supports
- GET fetch a new item
- POST creates a new item
- PUT updates an item
- DELETE removes an item
As can be illustrated in the following screenshot
(image credit to HPE's Agile Manager API Intractive Help (beta)
Resources
The API supports the following resources, which can be used as part of the query
method:
- applications
- backlog_items
- backlog_item (attachments)
- features
- feature (attachments)
- release_teams
- releases
- release (attachments)
- sprints
- tasks
- team_members
- teams
- themes
- theme (attachments)
- workspaces
Author
Liran Tal liran.tal@gmail.com