Get One Online Archive¶
You can retrieve an online archive using
its ID. You can also view an online archive from the Atlas
UI. You must have GROUP_READ_ONLY
(Project Read Only
) role to retrieve an online archive.
The Atlas API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.
To learn how to configure API access for an Atlas project, see Configure Atlas API Access.
Groups and projects are synonymous terms. Your {GROUP-ID}
is the
same as your project ID. For existing groups, your group/project ID
remains the same. The resource and corresponding endpoints use the
term groups
.
https://cloud.mongodb.com/api/atlas/v1.0
Syntax¶
GET /groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/onlineArchives/{ARCHIVE-ID}
Request Parameters¶
Request Path Parameters¶
Path Element | Necessity | Description |
---|---|---|
GROUP-ID | Required | Unique identifier of the project that contains the specified cluster. |
CLUSTER-NAME | Required | Name of the cluster that contains the collection. |
ARCHIVE-ID | Required | Unique identifier of the online archive to retrieve. |
Request Query Parameters¶
The following query parameters are optional:
Query Parameter | Type | Description | Default |
---|---|---|---|
pretty | boolean | Displays response in a prettyprint format. | false |
envelope | boolean | Specifies whether or not to wrap the response in an envelope. | false |
Response Elements¶
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | string | ID of the online archive. | ||||||||||||
clusterName | string | Name of the cluster that contains the collection. | ||||||||||||
collName | string | Name of the collection. | ||||||||||||
criteria | document | Criteria to use for archiving data. | ||||||||||||
criteria.type | string | Type of criteria. Value can be one of the following:
| ||||||||||||
criteria.dateField | string | If criteria.type is DATE , name of the date field that
the online archive is based on. Data is archived when the
current date is after the date specified here plus the number of
days specified via the expireAfterDays parameter. | ||||||||||||
criteria.dateFormat | enum | If
| ||||||||||||
criteria.expireAfterDays | int | If criteria.type is DATE , number of days that specifies
the age limit for the data in the live Atlas cluster. Data is
archived when the current date is greater than the value of the
date field specified via the dateField parameter plus the number
of days specified here. | ||||||||||||
criteria.query | int | If criteria.type is CUSTOM , JSON query used to select
documents for archiving. The specified query is used with the
db.collection.find(query) command. | ||||||||||||
dbName | string | Name of the database that contains the collection. | ||||||||||||
groupId | string | Unique identifier of the project that contains the cluster. | ||||||||||||
partitionFields | document array | Fields to use to partition data. | ||||||||||||
partitionFields.fieldName | string | Name of the field. | ||||||||||||
partitionFields.fieldType | string | Data type of the field. | ||||||||||||
partitionFields.order | int | Position of the field in the partition. Value can be:
| ||||||||||||
paused | boolean | State of the online archive. Value is:
| ||||||||||||
state | string | Status of the online archive. Valid values are:
|
Example¶
The following example request retrieves an online archive by its ID. The
example response contains the online archive with the ID
5ebad3c1fe9c0ab8d37d61e1
for the people.employees
collection in
the cluster named myTestClstr
.
Example Request¶
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Content-Type: application/json" \ --include \ --request GET "https://cloud.mongodb.com/api/atlas/v1.0/groups/5e2211c17a3e5a48f5497de3/clusters/myTestClstr/onlineArchives/5ebad3c1fe9c0ab8d37d61e1?pretty=true"
Example Response¶
{ "_id": "5ebad3c1fe9c0ab8d37d61e1", "clusterName": "myTestClstr", "collName": "employees", "criteria": { "type": "DATE", "dateField": "created", "dateFormat": "ISODATE", "expireAfterDays": 5 }, "dbName": "people", "groupId": "5e2211c17a3e5a48f5497de3", "partitionFields": [ { "fieldName": "firstName", "fieldType": "string", "order": 0 }, { "fieldName": "lastName", "fieldType": "string", "order": 1 }, { "fieldName": "created", "fieldType": "date", "order": 2 } ], "paused": false, "state": "ACTIVE" }
Error Codes¶
If the request fails, it returns the following error:
Error Code | Description |
---|---|
RESOURCE_NOT_FOUND | The specified archive ID is not valid. |