-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In this morning's Asset Tracker Engineering Sprint, Rodrigo, Junbin, Roy drafted the URL structure for the updated back-end.
GET /authorizations.json
- INPUT
- OUTPUT
- 200 returns dictionary
-
userId (string) = 123
-
roles (list of strings) = ["con-edison member", "pg-and-e member"]
leader = APPA superuser
member
spectator
con-edison leader- Can add and edit assets in sketch mode (has access to SKETCH mode)
pg-and-e member
- Can only add and edit and comment on tasks
- Does not have access to sketch mode
pg-and-e spectator
- Cannot edit anything, only view
- Does not have access to sketch mode
-
- 401 Unauthorized
- 200 returns dictionary
GET /authorizations/leave
- INPUT
- OUTPUT
- 200
GET /assets.json
- INPUT
- (optional) q = search string = ‘assets x’
- OUTPUT
- 400 BAD REQUEST
- 401 NOT AUTHORIZED
- 200 returns List of assets that match string
Each asset-
id = STRING
-
typeId = STRING (m for meter, s for substation, t for transformer)
-
name = STRING
-
attributes = DICTIONARY of asset type specific attributes (depends on asset type)
- vendor = STRING
- product = STRING
- version = STRING -
busByIndex = DICTIONARY
0: {
id of bus
attributes for connection
}
-
PATCH /assets.json
- INPUT
- OUTPUT
- Same as output of GET /assets.json
DELETE /assets/123.json
- INPUT
- OUTPUT
- 200 SUCCESS
- 401 NOT AUTHORIZED
- 404 NOT FOUND
GET /tasks.json
- INPUT
- OUTPUT
- 200 returns List of object
Each object- id = STRING
- name = STRING
- status = INTEGER
0 = New
100 = Done
- 200 returns List of object
POST /tasks.json Create new task
- INPUT = Object
- id
- name
- status = 0 default
- OUTPUT
- 201 Created
- id = id of new task
- 400 Bad Request
- 201 Created
PATCH /tasks/123.json Update existing task
- INPUT
- Same as input for post (but can omit fields that are not being updated)
- OUTPUT
- 200 Success
- 400 bad request
- 404 not found
DELETE /tasks/123.json Delete existing task
- OUTPUT
- 200 success
- 404 not found
GET /tasks/123/comments.json Get all comments for task
- INPUT
- OUTPUT: List/Array that match the tasks’ id
- id = id of comment = STRING
- text = text of comment
- creationTime = timestamp when comment was created
- modificationTime = timestamp when comment was modified
- userId = user who made comment
POST /tasks/123/comments.json Add a new comment
- INPUT
- OUTPUT
- 200
- id = id of new comment
- 200
PATCH /tasks/123/comments/123.json Edit an existing comment
- INPUT
- OUTPUT
- 200 success
- 404 not found
DELETE /tasks/123/comments/123.json Delete an existing comment
- INPUT
- OUTPUT
- 200 success
- 404 not found
GET /risks.json
- INPUT
- OUTPUT = list of objects
- id = STRING
- assetId = STRING
- name = STRING