-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasset-types.http
108 lines (100 loc) · 2.62 KB
/
asset-types.http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
### [Asset types] List all asset types with attributes (read-only)
GET {{api-server}}/v2/asset-types?expansions=AssetType.attributes HTTP/1.1
X-Api-Key: {{read-only-token}}
### [Asset types] Create or update a new asset type (read–write)
PUT {{api-server}}/v2/asset-types?expansions=AssetType.attributes HTTP/1.1
X-Api-Key: {{read-write-token}}
Content-Type: application/json
{
"name": "weather_location2",
"custom": true,
"vendor": "Acme Weather Inc.",
"model": "WX-100",
"translation": {
"en": "Weather Location",
"de": "Wetter Ort"
},
"urldoc": "https://example.com/docs/weather_location",
"icon": "weather",
"payloadFunction": "PLS",
"allowedInactivity": "0 hours 5 mins",
"isTracker": false,
"attributes": [
{
"name": "temperature",
"subtype": "input",
"type": "temperature",
"enable": true,
"virtual": false,
"unit": "°C",
"precision": 1,
"min": 0.0,
"max": 50.0,
"translation": {
"en": "Temperature",
"de": "Temperatur"
}
},
{
"name": "humidity",
"subtype": "input",
"type": "humidity",
"enable": true,
"virtual": false,
"unit": "%",
"precision": 0,
"min": 0,
"max": 100,
"translation": {
"en": "Humidity",
"de": "Luftfeuchtigkeit"
}
}
]
}
### [Asset types] Get an asset type by name with expansions (read-only)
GET {{api-server}}/v2/asset-types/weather_location?expansions=attributes HTTP/1.1
X-Api-Key: {{read-only-token}}
### [Asset types] Delete an asset type by name (read–write)
DELETE {{api-server}}/v2/asset-types/weather_location HTTP/1.1
X-Api-Key: {{read-write-token}}
### [Asset types] Create a new attribute for an asset type (read–write)
POST {{api-server}}/v2/asset-types/weather_location/attributes HTTP/1.1
X-Api-Key: {{read-write-token}}
Content-Type: application/json
{
"name": "pressure",
"subtype": "input",
"type": "pressure",
"enable": true,
"virtual": false,
"unit": "hPa",
"precision": 0,
"min": 950,
"max": 1050,
"translation": {
"en": "Pressure",
"de": "Luftdruck"
},
"formula": "value * 1.0"
}
### [Asset types] Update an attribute for an asset type (read–write)
PUT {{api-server}}/v2/asset-types/weather_location/attributes HTTP/1.1
X-Api-Key: {{read-write-token}}
Content-Type: application/json
{
"name": "pressure",
"subtype": "input",
"type": "pressure",
"enable": true,
"virtual": false,
"unit": "hPa",
"precision": 0,
"min": 960,
"max": 1040,
"translation": {
"en": "Pressure Updated",
"de": "Luftdruck Aktualisiert"
},
"formula": "value * 1.0"
}