Retrieving documents
This call will allows you to retrieve a document.
URL
/api/v1/documents
Method
GET
URL parameters
Parameter | Type | Required | Description |
---|---|---|---|
ddName | String | Yes | Name of the document definition. |
environmentId | String | Yes | ID of the environment. |
externalId | String | No | The external ID of the document that is to be retrieved. |
convertIds | Boolean | No | This parameter indicates whether BizzStream has to convert internal IDs to external IDs. The default value for this is false. |
_id | String | No | ID of the document this is to be retrieved. |
query | URL Encoded JSON Object | No | The URL encoded JSON object that contains a Mongo query. |
options | URL Encoded JSON Object | No | The options for executing the Mongo query. |
Note: In order to retrieve a document, you have to provide at least one of the __id_, externalId or query parameters.
The options field is a (URL encoded) JSON object that can contain the following fields:
Query Parameter | Type | Description |
---|---|---|
sort | JSON Object | Used for the soring order (default: natural order). This is an object that contains the fields and their sorting order. The value -1 represents a descending sorting order while the value 1 represents an ascending sorting order. For instance, {"projectNumber": 1} sorts the documents ascending based on the project number. |
skip | Integer | Number of results to skip at the beginning. |
fields | JSON Object | Dictionary of fields to return or exclude. This is an object that contains the fields and an indication of whether the field is included (value 1) or excluded (value -1). For instance, {"description": 1} ensures that only the field description is included from the result. |
limit | Integer | Maximum number of results to return. For example, "limit": 100 limits the results to 100 documents even if more documents match the query. |
An example of an options object is:
{
"sort": { "name": -1},
"limit": 100,
"fields": {"name": 1,"price": 1}
}
When this is URL encoded, the full URL parameter is
options=%7B%20%0D%0A%22sort%22%3A%20%7B%20%22name%22%3A%20-1%7D%2C%0D%0A%22limit%22%3A%20100%2C%0D%0A%22fields%22%3A%20%7B%22name%22%3A%201%2C%22price%22%3A%20-1%7D%0D%0A%7D
Header Parameters
Parameter | Type | Required | Description |
---|---|---|---|
Content-Type | String | Yes | Provide the content type of your call. Only application/json is supported. |
X-User-Id | String | Yes | The ID of the user who wants to trigger the REST action. This ID is returned by the authentication call. |
X-Auth-Token | String | Yes | The authentication token that the authentication call returned. |
Limits
The call is subject to some limits. Click here to find out more.
Example
curl /api/v1/documents?ddName=project&environmentId=a83rh4aX5nzBsGL3S&_id=kZLfwSWzx5pfbqW37k \
-H "X-Auth-Token: 6IrqyFhbKjpyJZ_NX6dwLmRNxWk0OVffE8aBfauNKUG" \
-H "X-User-Id: a6gA9rYaGTFKPrT5P" \
-H "Content-Type: application/json" \
-X GET