Skip to content

Instantly share code, notes, and snippets.

@lirantal
Created November 7, 2015 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lirantal/c02902a043e8935d8b19 to your computer and use it in GitHub Desktop.
Save lirantal/c02902a043e8935d8b19 to your computer and use it in GitHub Desktop.
Agile Manager API guideline
#!/bin/bash
##
## HPE's Agile Manager (AGM) API
## Guideline for working with the API
## Mainly adopted from Olivier@HPE
##
## Explanation:
## -k - Ok to make insecure SSL connections by curl
## -X POST - Specifies this HTTP request method to be of POST type
## client_id - This is the API key generated when you create a new client API integration from AGM tool
## client_secret - This is the API key secret generated for the client_id API key
## grant_type -
curl -k -X POST -d "client_id=api_client_your_own_agm_client_id&client_secret=your_agm_api_secret&grant_type=client_credentials" https://agilemanager-ast.saas.hp.com/agm/oauth/token
## The request returns a JSON object with the access token required to make subsequent requests:
## {"access_token":"128682382_6057d73b-65a1-5981-8bbf-80f0180de092","token_type":"bearer","expires_in":3599,"scope":"read trust write"}
## Once an access token was obtained, any API further API calls require an Authorization header to be sent with the access token value to be valid:
curl -k -H "Authorization: bearer 128682382_6057d73b-65a1-5981-8bbf-80f0180de092" "https://agilemanager-ast.saas.hp.com:443/agm/api/workspaces/1001/backlog_items?query=%22!(status%3D'Done')%3Bsubtype%3D'defect'%3Bapplication_id%3D42%22&order-by=-id&fields=id%2Cseverity%2Cname"
## This API calls queries the following:
## Gets id, severity and summary for defects in workspaceID 1001, application 42, ordered by descending ID
## - workspaceID: 1001
## - Query: "!(status='Done');subtype='defect';application_id=42"
## - Order-by: -id
## - Fields: id,severity,name
## Returns the following JSON response object:
## {
## "data": [
## {
## "type": "backlog_item",
## "subtype": "defect",
## "id": 1232,
## "name": "Notifications system doesnt work well with postfix servers",
## "severity": "3-Medium"
## },
## {
## "type": "backlog_item",
## "subtype": "defect",
## "id": 1252,
## "name": "Notifications system sometimes sends an e-mail twice",
## "severity": "2-High"
## },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment