Skip to content

Commit 24a9ffa

Browse files
unknownunknown
authored andcommitted
add last datapoint at device level
1 parent 62db723 commit 24a9ffa

File tree

4 files changed

+198
-96
lines changed

4 files changed

+198
-96
lines changed

SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* [Datapoint](datapoint/README.md)
1515
* [List](datapoint/list.md)
1616
* [Last](datapoint/last.md)
17+
* [Last (Sensor Level)](datapoint/last_sensor_level.md)
18+
* [Last (Device Level)](datapoint/last_device_level.md)
1719
* [Create](datapoint/create.md)
1820
* [MultiCreate](datapoint/multicreate.md)
1921
* [Edit](datapoint/edit.md)

datapoint/last.md

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1 @@
1-
# Get Last DataPoint
21

3-
## Description
4-
5-
Use **HTTP GET** request to obtain the last DataPoint for a specific sensor of a specific device
6-
7-
### Request URL
8-
9-
```
10-
http://api.mediatek.com/api/v1.0/devices/{device_id}/sensors/{sensor_id}/datapoints/last.{json/csv}
11-
```
12-
13-
### Action
14-
HTTP GET
15-
16-
### Parameters
17-
18-
#### Header
19-
20-
apiKey:`YOUR_API_KEY_HERE`
21-
Content-Type:application/json
22-
23-
### Response
24-
25-
#### Response Code
26-
200
27-
28-
#### Response Header
29-
30-
Content-Type:`application/json`
31-
#### Response Body
32-
33-
***Data Format: JSON***
34-
35-
The response body will construct in JSON format with the following fields:
36-
37-
| Field Name | Type |Description|
38-
| --- | --- | --- |
39-
| dataPointId | String | dataPoint ID |
40-
| updatedAt | String | Last Device update Timestamp |
41-
| content | json | dataPoint Value (vary by sensor type) |
42-
43-
44-
**Example 1: Request for response in json **
45-
46-
Request URL (request for response in json format)
47-
```
48-
http://api.mediatek.com:80/api/v1.0/devices/100000009/sensors/1000000011/datapoints/last.json
49-
```
50-
Response Body
51-
52-
```
53-
{
54-
"results": [
55-
{
56-
"datapointId": "10000000111409730143369",
57-
"updatedAt": "1409730143364",
58-
"sensorId" : "1000000011",
59-
"content": "{\"value\":\"69.03\"}"
60-
}
61-
]
62-
}
63-
```
64-
65-
**Example 2: Request for response in csv **
66-
67-
Request URL (request for response in json format)
68-
```
69-
http://api.mediatek.com:80/api/v1.0/devices/100000009/sensors/1000000011/datapoints/last.csv
70-
```
71-
Response Body
72-
73-
```
74-
10000000111409281268924,1000000011,1409281268918,58.49
75-
```
76-
77-
78-
### Error Response
79-
80-
When error is incurred, the response code will be non-200 and the response body will construct in JSON format with the following fields:
81-
82-
| Field Name | Type |Description|
83-
| --- | --- | --- |
84-
| code | Integer | Error Code |
85-
| url | String | url to API Error detail page |
86-
| description | String | Error Description |
87-
88-
**Example: **
89-
```
90-
{
91-
"results": {
92-
"code": 1002,
93-
"url": "http://mcs.mediatek.com/api_errorcode?code=1002",
94-
"description": "You do not have access right to this API"
95-
}
96-
}
97-
```

datapoint/last_device_level.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Get Last DataPoint (Device Level)
2+
3+
## Description
4+
5+
Use **HTTP GET** request to obtain the last DataPoint for a specific sensor of a specific device
6+
7+
### Request URL
8+
9+
```
10+
http://api.mediatek.com/api/v1.0/devices/{device_id}/datapoints/last.{json/csv}
11+
```
12+
13+
### Action
14+
HTTP GET
15+
16+
### Parameters
17+
18+
#### Header
19+
20+
apiKey:`YOUR_API_KEY_HERE`
21+
Content-Type:application/json
22+
23+
### Response
24+
25+
#### Response Code
26+
200
27+
28+
#### Response Header
29+
30+
Content-Type:`application/json`
31+
#### Response Body
32+
33+
***Data Format: JSON***
34+
35+
The response body will construct in JSON format with the following fields:
36+
37+
| Field Name | Type |Description|
38+
| --- | --- | --- |
39+
| dataPointId | String | dataPoint ID |
40+
| updatedAt | String | Last Device update Timestamp |
41+
| content | json | dataPoint Value (vary by sensor type) |
42+
43+
44+
**Example 1: Request for response in json **
45+
46+
Request URL (request for response in json format)
47+
```
48+
http://api.mediatek.com:80/api/v1.0/devices/100000009/datapoints/last.json
49+
```
50+
Response Body
51+
52+
```
53+
{
54+
"results": [
55+
{
56+
"datapointId": "10000000111409730143369",
57+
"updatedAt": "1409730143364",
58+
"sensorId" : "1000000011",
59+
"content": "{\"value\":\"69.03\"}"
60+
}
61+
]
62+
}
63+
```
64+
65+
**Example 2: Request for response in csv **
66+
67+
Request URL (request for response in json format)
68+
```
69+
http://api.mediatek.com:80/api/v1.0/devices/100000009/datapoints/last.csv
70+
```
71+
Response Body
72+
73+
```
74+
10000000111409281268924,1000000011,1409281268918,58.49
75+
```
76+
77+
78+
### Error Response
79+
80+
When error is incurred, the response code will be non-200 and the response body will construct in JSON format with the following fields:
81+
82+
| Field Name | Type |Description|
83+
| --- | --- | --- |
84+
| code | Integer | Error Code |
85+
| url | String | url to API Error detail page |
86+
| description | String | Error Description |
87+
88+
**Example: **
89+
```
90+
{
91+
"results": {
92+
"code": 1002,
93+
"url": "http://mcs.mediatek.com/api_errorcode?code=1002",
94+
"description": "You do not have access right to this API"
95+
}
96+
}
97+
```
98+
# Last (Device Level)

datapoint/last_sensor_level.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Get Last DataPoint (Sensor Level)
2+
3+
## Description
4+
5+
Use **HTTP GET** request to obtain the last DataPoint for a specific sensor of a specific device
6+
7+
### Request URL
8+
9+
```
10+
http://api.mediatek.com/api/v1.0/devices/{device_id}/sensors/{sensor_id}/datapoints/last.{json/csv}
11+
```
12+
13+
### Action
14+
HTTP GET
15+
16+
### Parameters
17+
18+
#### Header
19+
20+
apiKey:`YOUR_API_KEY_HERE`
21+
Content-Type:application/json
22+
23+
### Response
24+
25+
#### Response Code
26+
200
27+
28+
#### Response Header
29+
30+
Content-Type:`application/json`
31+
#### Response Body
32+
33+
***Data Format: JSON***
34+
35+
The response body will construct in JSON format with the following fields:
36+
37+
| Field Name | Type |Description|
38+
| --- | --- | --- |
39+
| dataPointId | String | dataPoint ID |
40+
| updatedAt | String | Last Device update Timestamp |
41+
| content | json | dataPoint Value (vary by sensor type) |
42+
43+
44+
**Example 1: Request for response in json **
45+
46+
Request URL (request for response in json format)
47+
```
48+
http://api.mediatek.com:80/api/v1.0/devices/100000009/sensors/1000000011/datapoints/last.json
49+
```
50+
Response Body
51+
52+
```
53+
{
54+
"results": [
55+
{
56+
"datapointId": "10000000111409730143369",
57+
"updatedAt": "1409730143364",
58+
"sensorId" : "1000000011",
59+
"content": "{\"value\":\"69.03\"}"
60+
}
61+
]
62+
}
63+
```
64+
65+
**Example 2: Request for response in csv **
66+
67+
Request URL (request for response in json format)
68+
```
69+
http://api.mediatek.com:80/api/v1.0/devices/100000009/sensors/1000000011/datapoints/last.csv
70+
```
71+
Response Body
72+
73+
```
74+
10000000111409281268924,1000000011,1409281268918,58.49
75+
```
76+
77+
78+
### Error Response
79+
80+
When error is incurred, the response code will be non-200 and the response body will construct in JSON format with the following fields:
81+
82+
| Field Name | Type |Description|
83+
| --- | --- | --- |
84+
| code | Integer | Error Code |
85+
| url | String | url to API Error detail page |
86+
| description | String | Error Description |
87+
88+
**Example: **
89+
```
90+
{
91+
"results": {
92+
"code": 1002,
93+
"url": "http://mcs.mediatek.com/api_errorcode?code=1002",
94+
"description": "You do not have access right to this API"
95+
}
96+
}
97+
```
98+
# Last (Sensor Level)

0 commit comments

Comments
 (0)