GET: Read all instances
This topic provides instructions for using the GET operation to retrieve information about all entities.
Overview
An instance is a complete functional unit of information, for example, a single defect. The properties of an instance are represented by data in JSON format.
Instances are members of collections. See Collections.
To get the resource for an entity, use the URI for the entity collection.
GET .../api/shared_spaces/{shared_space_uid}/workspaces/{workspace_id}/defects
Note: When GETting instances, the REST API does not necessarily display all fields for the instance. For a complete list of available fields, see Retrieving metadata.
Examples
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects
*** Response *** { "total_count": 3, "data": [{ "type": "defect", "creation_time": "2016-10-27T10:35:46Z", "parent": { "type": "work_item_root", "id": "1001" }, "version_stamp": 9, "description": "<html><body>\n<p>Emptying out items in cart takes way too long. It could take more than 45 seconds. </p> \n</body></html>", "id": "1014", "severity": { "type": "list_node", "id": "1005" }, "name": "Emptying out items in cart takes way too long", ... }, { "type": "defect", "creation_time": "2016-10-27T10:32:23Z", "parent": { "type": "feature", "id": "1007" }, "version_stamp": 8, "description": "<html><body>\n<p>Shortcut key for deleting all items in cart does not work when there are more than 10 items in the cart.</p> \n</body></html>", "id": "1012", "severity": { "type": "list_node", "id": "1003" }, "name": "Shortcut key for deleting all items in cart does not work.", ... }, { "type": "defect", "creation_time": "2016-10-27T10:33:03Z", "parent": { "type": "feature", "id": "1007" }, "version_stamp": 9, "description": "<html><body>\n<p>When adding one item to cart, it appears as if the item was added two times. In actuality, it is only added once. If the user refreshes the screen, it appears correctly. This only happens in Chrome.</p> \n</body></html>", "id": "1013", "severity": { "type": "list_node", "id": "1005" }, "name": "When adding one item to cart, it appears as if the item was added two times.", ... }], "exceeds_total_count": false }
GET .../api/shared_spaces
*** Response *** { "total_count": 1, "data": [ { "type": "shared_space", "name": "Default Isolated Space", "id": "1001" } ], "exceeds_total_count": false }
Only the workspaces for the current user are returned.
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/workspaces
*** Response *** { "total_count": 2, "data": [ { "type": "workspace", "creation_time": "2017-05-20T19:08:12Z", "version_stamp": 1, "name": "default_workspace", "id": "1002", "last_modified": "2017-05-20T19:08:12Z" }, { "type": "workspace", "creation_time": "2017-05-21T08:03:25Z", "version_stamp": 1, "name": "MyWorkspace", "id": "1003", "last_modified": "2017-05-21T08:03:25Z" } ], "exceeds_total_count": false }
This example demonstrates how space admins can GET the history of deleted workspaces in the space context. This example uses the special resource deleted-workspaces, and in this case, two workspaces were deleted, Payroll and Logistics.
For an example of how to delete a workspace, see Example: DELETE a specific workspace.
POST .../api/shared_spaces/1001/deleted-workspaces
*** Sample response ***
[ { "time": "2018-05-27T19:06:59Z", "workspace_id": 2001, "workspace_name": "Payroll", "user_name": "marta@MyCompany.com", "session_id": "9a1d3ee5-4f63-4fcf-aa99-fd660944fcd1" }, { "time": "2018-05-27T19:11:24Z", "workspace_id": 2002, "workspace_name": "Logistics", "user_name": "Lee@MyCompany.com", "session_id": "bb983a8a-b0ca-42b5-b359-b405f0e8c577" } ]
See also: