export.collection.dump
The export.collection.dump is used to export all, or part of a collection from an Org. To export specify the count of records that need to be exported from a collection. If the collection is too large to get exported, it will return the last database object ID (lastId) that is exported. To continue exporting, use the export.collection.dump with the returned object ID(lastId) and pass it to afterId as explained below.
Initial TR50 Request
The following example shows an initial request:
{
"cmd": {
"command": "export.collection.dump",
"params": {
"collection": "properties",
"count": 2000
}
}
}
TR50 Response gets the lastId value
When the initial request is made, the returned result will include the parameter lastId containing a unique Id of the last collection item returned. Example response for the above request:
{
"1" : {
"success" : true,
"params" : {
"lastId":"5c99a6bffe2a136ba9ad89e8",
"more":true,
"records" : [
{ ... },
{ ... },
...
]
}
}
}
TR50 Request with afterId
The lastId value should be passed on to the afterId parameter for the subsequent collection items until the entire result set has been returned. A subsequent request after the initial response is shown below:
{
"cmd": {
"command": "export.collection.dump",
"params": {
"afterId":"5c99a6bffe2a136ba9ad89e8",
"collection": "properties",
"count": 2000
}
}
}
When there is no more data to iterate through you will get the following response:
{
"cmd": {
"success": true,
"params": {
"more": false
}
}
}
History collections (i.e. alarms, properties, and so on) will not contain records of objects shared to the Org that is being exported.
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
afterID | String | Identifies the database Object ID that precedes the first record that will be exported. | |
collection | String | Yes | Identifies the collection that will be exported from. |
count | Integer |
Identifies the max count of records that is exported from the collection. export.collection.dump can retrieve a maximum of 5000 records. It returns two values lastid and more that indicates that there are more records in the database. |
|
start | String | A timestamp representing the start of the absolute time period. | |
end | String | A timestamp representing the end of the absolute time period. |
{
"1" : {
"success" : true,
"params" : {
"lastId":"12391210910921091091",
"more":true,
"records" : [
{ ... },
{ ... },
...
]
}
}
}
Response Parameters
Name | Type | Description |
---|---|---|
lastId | String | The database Object ID of the last record exported |
more | Boolean | True, indicates that there are more records in the database. |
records | Array | An array of record objects from a collection. |
The output of this API shows the underlying data structure which changes in the process of optimization or improvements. For a stable outputs with backwards compatibility, use the service API calls for the particular data you are trying to access. For example, instead of "collection" : "log"
use log.list
The table lists the changes done to the export.collection.dump API corresponding to deviceWISE Cloud releases:
Version | Collection | Description |
---|---|---|
18.10 | Log | The triggerId, thingId, campaignId and licenseId fields have been merged into a single field searchId. |