Skip to content

Latest commit

 

History

History
156 lines (124 loc) · 3.97 KB

api.md

File metadata and controls

156 lines (124 loc) · 3.97 KB

API

If you are running the server and want to enable the API, set the environment variable API_ENABLED=true.

This API is currently in a very limited alpha, and is not enabled in any of our deployments. Note that this API may change at any time, without warning.

Schemas

Step

Attribute Type Note
id integer
status string Can be pending, actionable, approved, or canceled
user User a.k.a. "the approver"

NCR Work Order

Attribute Type Note
amount string (decimal) The cost of the work order
building_number string (full list)
code null for BA61, string for BA80 Identifier for the type of work
description string
emergency boolean Whether the work order was pre-approved or not (can only be true for BA61)
expense_type string BA61 or BA80
id integer
name string
not_to_exceed boolean If the amount is exact, or an upper limit
office string The group within the service center who submitted the work order (full list)
proposal Proposal
rwa_number null for BA61, string for BA80 Essentially the internal bank account number
vendor string

Proposal

The central, generic data structure that maintains workflow information.

Attribute Type Note
steps [ Step ]
created_at string (time)
id integer
requester User
status string Can be pending, approved, or canceled
updated_at string (time)

User

Attribute Type Note
created_at string (time)
email_address string only shown when logged in
first_name string only shown when logged in
id integer
last_name string only shown when logged in
updated_at string (time)

Endpoints

GET /api/v1/users.json

Query parameters

All are optional.

Name Values
limit an integer >= 0
offset an integer >= 0
Example

https://c2-dev.cf.18f.us/api/v1/users.json?limit=5&offset=10

Response

Returns an array of Users.

[
  {
    "created_at": "2015-01-10T07:05:42.445Z",
    "email_address": "[email protected]",
    "first_name": "Liono",
    "id": 43,
    "last_name": "Appolo",
    "updated_at": "2015-01-10T07:05:42.445Z"
  },
  // ...
]

GET /api/v1/ncr/work_orders.json

Query parameters

All are optional.

Name Values
limit an integer >= 0
offset an integer >= 0
Example

https://c2-dev.cf.18f.us/api/v1/ncr/work_orders.json?limit=5&offset=10

Response

Returns an array of Work Orders, in descending order of creation.

[
  {
    "amount": "1000.00",
    "building_number": "DC0017ZZ ,WHITE HOUSE-WEST WING1600 PA AVE. NW",
    "code": "ABC",
    "description": "Existing paint is starting to crack.",
    "emergency": false,
    "expense_type": "BA80",
    "id": 16,
    "name": "Blue paint for the Blue Room",
    "not_to_exceed": false,
    "office": "P1121209 Security Management",
    "proposal": {
      "steps": [
        {
          "id": 92,
          "status": "pending",
          "user": {
            "created_at": "2015-01-10T07:05:42.445Z",
            "id": 43,
            "updated_at": "2015-01-10T07:05:42.445Z"
          }
        }
      ],
      "created_at": "2015-02-21T07:05:42.445Z",
      "id": 12,
      "requester": {
        "created_at": "2015-02-10T07:05:42.445Z",
        "id": 71,
        "updated_at": "2015-02-10T07:05:42.445Z"
      },
      "status": "pending",
      "updated_at": "2015-03-28T01:13:33.564Z"
    },
    "rwa_number": "123456A",
    "vendor": "ACME Corp"
  },
  // ...
]