GET /api/v2/table/{path}
Retrieves one or more documents from a HPE Ezmeral Data Fabric Database JSON table
Parameters
Name | Description |
---|---|
path
(path) |
Required: Path to the HPE Ezmeral Data Fabric Database JSON table |
condition
(query) |
Query condition (in JSON format) to evaluate on documents retrieved. See OJAI Query Condition Syntax for a description of the syntax. |
fields
(query) |
The fields from the document to retrieve. See JSON Document Field Paths for details about how to specify field paths. |
fromId
(query) |
Starting id of the range of documents to retrieve (inclusive) |
toId
(query) |
Ending id of the range of documents to retrieve (exclusive) |
getPlan
(query) |
If set to Default: False |
limit
(query) |
The maximum number of documents to retrieve |
offset
(query) |
The number of documents to skip past before returning results |
orderBy
(query) |
The fields on which to sort the result. Specify the fields in a
comma separated list, in the format |
query
(query) |
Query string with predefined keywords that define the behavior of the query. See Query with --query for syntax details. |
withTags
(query) |
Enables or disables output with extended type tags Value: True|False Default: True |
Request Examples
- The following retrieves all documents from
/apps/employees
:curl -X GET \ 'https://10.10.100.42:8243/api/v2/table/%2Fapps%2Femployees' \ -u root:mapr
- The following specifies an offset and limit in the GET
request:
curl -X GET \ 'https://10.10.100.42:8243/api/v2/table/%2Fapps%2Femployees%2F?offset=1&limit=2' \ -u root:mapr
- The following retrieves only the first names in the
documents:
curl -X GET \ 'https://10.10.100.42:8243/api/v2/table/%2Fapps%2Femployees?fields=first_name' \ -u root:mapr
- The following retrieves all documents with a last name of
'Doe'
:curl -g -X GET \ 'https://10.10.100.42:8243/api/v2/table/%2Fapps%2Femployees?condition={"$eq":{"last_name":"Doe"}}' \ -u root:mapr
NOTEYou must pass'-g'
in thecURL
command due to the nested braces in the condition. - The following retrieves the id and first name of documents with a last name of
'Doe
':curl -g -X GET \ 'https://10.10.100.42:8243/api/v2/table/%2Fapps%2Femployees?condition={"$eq":{"last_name":"Doe"}}&fields=_id,first_name' \ -u root:mapr
- The following runs the same command and includes a request for the query
plan:
curl -g -X GET \ 'https://10.10.100.42:8243/api/v2/table/%2Fapps%2Femployees?condition={"$eq":{"last_name":"Doe"}}&fields=_id,first_name&getPlan=true' \ -u root:mapr
Response Examples
200 OK { "DocumentStream": [ { "_id": "user001", "first_name": "John", "last_name": "Doe" }, { "_id": "user002", "first_name": "Jane", "last_name": "Doe" }, { "_id": "user003", "first_name": "Simon", "last_name": "Davis" } ] }
If you have configured the MapR Data Access Gateway to limit the number of documents in
retrieval requests, and your result set exceeds the limit, the API response includes a
warning. In the following example, the limit is set to
2:
{ "DocumentStream": [ { "_id": "user001", "first_name": "John", "last_name": "Doe" }, { "_id": "user002", "first_name": "Jane", "last_name": "Doe" } ], "WARNING": "result truncated due to limit set to 2." }
The following shows an example of output that includes a query plan. It corresponds to the
output from example #6 in the previous
section:
{ "DocumentStream": [ { "_id": "user001", "first_name": "John" }, { "_id": "user002", "first_name": "Jane" } ], "QueryPlan": [ [ { "streamName": "DBDocumentStream", "parameters": { "queryConditionPath": true, "projectionPath": [ "_id", "first_name" ], "primaryTable": "/apps/employees" } } ] ] }