{"_id":"5851c2718693f30f000f56a3","user":"573b7f42fdc9d320001b777d","__v":0,"category":{"_id":"582789abbe5c080f00a5a802","__v":0,"version":"582789aabe5c080f00a5a7fe","project":"568bdc1483d2061900d86cdc","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-01-16T07:43:25.407Z","from_sync":false,"order":11,"slug":"environment-api","title":"Environments"},"version":{"_id":"582789aabe5c080f00a5a7fe","__v":10,"project":"568bdc1483d2061900d86cdc","createdAt":"2016-11-12T21:29:14.915Z","releaseDate":"2016-11-12T21:29:14.915Z","categories":["582789abbe5c080f00a5a7ff","582789abbe5c080f00a5a800","582789abbe5c080f00a5a801","582789abbe5c080f00a5a802","582789abbe5c080f00a5a803","582789abbe5c080f00a5a804","582789abbe5c080f00a5a805","582789abbe5c080f00a5a806","582789abbe5c080f00a5a807","582789abbe5c080f00a5a808","5827ea984ca29e0f00137a9e","583df597887db62f00644283","583df5d9c622791900e78da5","5845cd8763c11b250037967d","5845d13063c11b2500379681","5859e859e3306d1900126725","587aeb9a01cf3a0f008359eb","587c422af45e2d0f005e200d","587d84dc82f6f30f004ceee5"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"beta2","version_clean":"0.0.0","version":"0"},"parentDoc":null,"project":"568bdc1483d2061900d86cdc","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-12-14T22:06:41.192Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"GET https://ioe.droplit.io/api/environments/E573bb9ffd717111220812c3a/history?startDate=2016-12-13T03:53:15.399Z&service=BinarySwitch&member=switch&type=changed HTTP/1.1\nauthorization: AUTH_TOKEN","language":"http"}]},"method":"get","results":{"codes":[{"code":"{\n    \"items\": [\n        {\n            \"deviceId\": \"D573bc694ae9ac9419f028b61\",\n            \"environmentId\": \"E573bb9ffd717111220812c3a\",\n            \"index\": \"0\",\n            \"member\": \"switch\",\n            \"packetId\": 96,\n            \"service\": \"BinarySwitch\",\n            \"time\": \"2016-12-13T21:53:55.763Z\",\n            \"transactionId\": \"58506df2ff965d3e01ffa073\",\n            \"type\": \"changed\",\n            \"value\": \"on\",\n            \"recordKey\": \"eventsC573b86eeee43dd7ba0244f8a;573bb9ffd717111220812c3a;90057175887065172ff965d3e01ffa074\"\n        },\n        {\n            \"deviceId\": \"D573bc694ae9ac9419f028b61\",\n            \"environmentId\": \"E573bb9ffd717111220812c3a\",\n            \"index\": \"0\",\n            \"member\": \"switch\",\n            \"packetId\": 47,\n            \"service\": \"BinarySwitch\",\n            \"time\": \"2016-12-13T05:43:53.761Z\",\n            \"transactionId\": \"584f8a98ff965d3e01ff9fee\",\n            \"type\": \"changed\",\n            \"value\": \"off\",\n            \"recordKey\": \"eventsC573b86eeee43dd7ba0244f8a;573bb9ffd717111220812c3a;90057176469082368ff965d3e01ff9fef\"\n        },\n        {\n            \"deviceId\": \"D573bc694ae9ac9419f028b61\",\n            \"environmentId\": \"E573bb9ffd717111220812c3a\",\n            \"index\": \"0\",\n            \"member\": \"switch\",\n            \"packetId\": 31,\n            \"service\": \"BinarySwitch\",\n            \"time\": \"2016-12-13T03:53:15.399Z\",\n            \"transactionId\": \"584f70acff965d3e01ff9faf\",\n            \"type\": \"changed\",\n            \"value\": \"on\",\n            \"recordKey\": \"eventsC573b86eeee43dd7ba0244f8a;573bb9ffd717111220812c3a;9005717653544560cff965d3e01ff9fb3\"\n        }\n    ]\n}","language":"json","status":200,"name":""},{"status":400,"name":"","code":"{\n  \"errorType\": \"InvalidParams\",\n  \"errors\": [\n    {\n      \"in\": \"query\",\n      \"message\": \"Must be a valid ISO 8601 string time\",\n      \"path\": \"startDate\"\n    }\n  ]\n}","language":"json"},{"code":"","language":"text","status":401},{"code":"","language":"text","status":403},{"language":"text","status":404,"code":"Environment with id E573bb9ffd717111220812c3b does not exist."}]},"settings":"572c39957c8eff0e00aaa18b","auth":"required","params":[{"_id":"5851c2718693f30f000f56ac","ref":"","in":"path","required":true,"desc":"[environment](doc:environments) id","default":"","type":"string","name":"id"},{"_id":"5851c2718693f30f000f56ab","ref":"","in":"query","required":false,"desc":"A system-generated token representing the page start","default":"","type":"string","name":"continuationToken"},{"_id":"5851c2718693f30f000f56aa","ref":"","in":"query","required":false,"desc":"Constrain query to events before the specified ISO 8601 date time","default":"","type":"datetime","name":"endDate"},{"_id":"5851c2718693f30f000f56a9","ref":"","in":"query","required":false,"desc":"Constrain query to services on a specified index","default":"","type":"int","name":"index"},{"_id":"5851c2718693f30f000f56a8","ref":"","in":"query","required":false,"desc":"Constrain query to a specified service member","default":"","type":"string","name":"member"},{"_id":"5851c2718693f30f000f56a7","ref":"","in":"query","required":false,"desc":"Number of results per page","default":"50","type":"int","name":"pageSize"},{"_id":"5851c2718693f30f000f56a6","ref":"","in":"query","required":false,"desc":"Constrain query to services of a specified name","default":"","type":"string","name":"service"},{"_id":"5851c2718693f30f000f56a5","ref":"","in":"query","required":false,"desc":"Constrain query to events after the specified ISO 8601 date time","default":"","type":"datetime","name":"startDate"},{"_id":"5851c2718693f30f000f56a4","ref":"","in":"query","required":false,"desc":"Constrain returned device action to the specified action type (changed, event, get, and set)","default":"","type":"string","name":"type"}],"url":"/environments/:id/history"},"isReference":true,"order":5,"body":"History is used to get a history of device actions within the specified environment. These actions may be filtered based on the supplied parameters.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Parameter notes\"\n}\n[/block]\n## continuation token\nContinuation tokens are used in order to get the next page when a query has paginated data. The user is not expected to arbitrarily fill in the token; rather, an endpoint with the token prefilled in is provided on the query results under the `next` property.\n\n## Date/Time filter\nThe results may be filtered to be within a specified date/time range using the `startDate` and/or `endDate` parameter. The date/times are formatted in the ISO 8601 date format. Note: the date/times are filtered based on when the server logged the event which _may_ be a after the time that the event happened.\n\n## Type\nThe type of the event. The types are:\n\n### Changed\nA property changed event. Property changed events are not limited to explicit set commands issued by a user.\n\n### Event\nA service event. These are events specified by a device’s service class.\n\n### Get\nA get event. These are triggered by get requests for a device using the `refresh` flag.\n\n### Set\nA set event. These are triggered by an explicit set command by a user.","excerpt":"Get history of device actions within an environment","slug":"history-environments","type":"endpoint","title":"History"}

getHistory

Get history of device actions within an environment

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

id:
required
string
[environment](doc:environments) id

Query Params

continuationToken:
string
A system-generated token representing the page start
endDate:
datetime
Constrain query to events before the specified ISO 8601 date time
index:
integer
Constrain query to services on a specified index
member:
string
Constrain query to a specified service member
pageSize:
integer50
Number of results per page
service:
string
Constrain query to services of a specified name
startDate:
datetime
Constrain query to events after the specified ISO 8601 date time
type:
string
Constrain returned device action to the specified action type (changed, event, get, and set)

Examples


Result Format


Documentation

History is used to get a history of device actions within the specified environment. These actions may be filtered based on the supplied parameters. [block:api-header] { "type": "basic", "title": "Parameter notes" } [/block] ## continuation token Continuation tokens are used in order to get the next page when a query has paginated data. The user is not expected to arbitrarily fill in the token; rather, an endpoint with the token prefilled in is provided on the query results under the `next` property. ## Date/Time filter The results may be filtered to be within a specified date/time range using the `startDate` and/or `endDate` parameter. The date/times are formatted in the ISO 8601 date format. Note: the date/times are filtered based on when the server logged the event which _may_ be a after the time that the event happened. ## Type The type of the event. The types are: ### Changed A property changed event. Property changed events are not limited to explicit set commands issued by a user. ### Event A service event. These are events specified by a device’s service class. ### Get A get event. These are triggered by get requests for a device using the `refresh` flag. ### Set A set event. These are triggered by an explicit set command by a user.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}