Skip to content

Commit 7cd751c

Browse files
authored
Now up to date!
All needed informations to integrate the ELEMENT IoT Plattform is written down in here.
1 parent e4f79db commit 7cd751c

File tree

1 file changed

+80
-10
lines changed

1 file changed

+80
-10
lines changed

README.md

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# element_iot
2+
#### included in PHP
23
###### Currently only GET Requests - updated soon
34
The PHP class makes it easy to access Zenner IoT's *ELEMENT IoT* platform.
45
It was builded for usage at [Stadtwerke Karlsruhe GmbH](https://stadtwerke-karlsruhe.de) , but can easily adapted
@@ -8,15 +9,16 @@ ___
89

910
```PHP
1011
require "element_iot.inc.php";
11-
$element_iot = new element_iot("api_key_found_on_settings_api_keys", "your.domain");//__construct($api_key, $domain)
12+
$element_iot = new element_iot("api_key_found_on_settings->api_keys", "your.domain", "proxy_if_needed");//__construct($api_key, $domain = NULL, $proxy = NULL)
1213
```
1314
There is no need for declaring an Transfer Protocol.
1415
It's always replaced with **https://**!
1516
The domain has a default value setted up for the usage at swka.
1617
___
1718
### Accessible Functions
19+
#### get()
1820

19-
In the first version are four accessible functions implemented.
21+
In the first version are six accessible functions implemented.
2022
I will list them in the following, with Parameters and description:
2123

2224
```PHP
@@ -30,8 +32,26 @@ The *get* function starts an GET Request to the given domain and returns the ans
3032
#### How to setup parameters?
3133

3234
( i ) *tp* stands for *type* and should define your request.
35+
The configuration is the same as listed on the [official api documentation](https://docs.element-iot.com/api/configuration/pagination/).
36+
37+
###### universal configuration
38+
The Array is directly converted into the GET Request.
39+
Pro: It's dynamic builded for the future.
40+
* **So use the key that you want to use as GET-Key as key for the Array and the GET-Value as Array value.**
41+
```PHP
42+
$configuration = [
43+
"limit" => 10,
44+
"sort" => "name",
45+
"sort_direction" => "ascending",
46+
"retrieve_after" => "ID of the last paginated item",
47+
"before" => "YYYY-MM-DD",
48+
"after" => "YYYY-MM-DD"
49+
]
50+
```
51+
3352
All currently possible possibilities are listed and explained in the following:
34-
##### Devices
53+
54+
##### Devices / Readings / Packets / Interfaces
3555
```PHP
3656
$element_iot->get(["devices"]);
3757
# Returns an array of all devices, filled up with information like: name, interfaces, etc. (without readings!)
@@ -47,21 +67,28 @@ The *get* function starts an GET Request to the given domain and returns the ans
4767
# Returns an array of interfaces.
4868
# > configuration
4969
```
50-
___
51-
##### Devices
70+
Configuration of: [Devices](https://docs.element-iot.com/api/resources/devices/) |
71+
Configuration of: [Readings](https://docs.element-iot.com/api/resources/readings/) |
72+
Configuration of: [Packets](https://docs.element-iot.com/api/resources/packets/) |
73+
Configuration of: [Interfaces](https://docs.element-iot.com/api/resources/interfaces/)
74+
75+
##### Tags
5276
```PHP
5377
$element_iot->get(["tags"]);
5478
# Returns an array of tags.
5579
# > configuration
5680
```
57-
___
81+
Configuration of: [Tags](https://docs.element-iot.com/api/resources/tags/)
82+
5883
##### Parsers
5984
```PHP
6085
$element_iot->get(["parsers"]);
6186
# Returns an array of parsers.
6287
# > configuration
6388
```
64-
___
89+
Configuration of: [Parsers](https://docs.element-iot.com/api/resources/parsers/)
90+
91+
6592
##### Drivers
6693
```PHP
6794
$element_iot->get(["drivers"]); //returns an HTTP 500 Error at the current ELEMENT Version!
@@ -73,21 +100,27 @@ ___
73100
# > configuration
74101

75102
```
76-
___
103+
Configuration of: [Drivers](https://docs.element-iot.com/api/resources/drivers/) |
104+
Configuration of: [Driver-Instances](https://docs.element-iot.com/api/resources/driver-instances/)
105+
77106
##### Groups
78107
```PHP
79108
$element_iot->get(["groups"]);
80109
# Returns an array of groups.
81110
# > configuration
82111
```
83-
___
112+
Configuration of: [Groups](https://docs.element-iot.com/api/resources/groups/)
113+
114+
84115
##### Api_keys
85116
```PHP
86117
$element_iot->get(["api_keys"]);
87118
# Returns an array of api_keys (if you are allowed to see them).
88119
# > configuration
89120
```
90-
___
121+
Configuration of: [Api_keys](https://docs.element-iot.com/api/resources/api-keys/)
122+
123+
91124
##### Mandates
92125
```PHP
93126
$element_iot->get(["mandates"]);
@@ -102,3 +135,40 @@ ___
102135
# > configuration
103136

104137
```
138+
Configuration of: [Mandates](https://docs.element-iot.com/api/resources/mandates/) |
139+
Configuration of: [stats / Statistics](https://docs.element-iot.com/api/resources/stats/)
140+
___
141+
142+
#### set_api_key($api_key)
143+
```PHP
144+
$element_iot->set_api_key("you_new_api_key");
145+
```
146+
Renew the API Key of an already initialized object.
147+
148+
#### get_api_key()
149+
```PHP
150+
$element_iot->set_api_key("you_new_api_key");
151+
```
152+
Returns an String with the length of 32 characters, where 24 are *invisible*.
153+
> For Identification if you use it for productiv systems with customers, etc.
154+
155+
#### get_cached_data()
156+
```PHP
157+
$element_iot->get_cached_data();
158+
```
159+
Returns the answer of the last request.
160+
161+
#### set_domain($domain)
162+
```PHP
163+
$element_iot->set_domain("your_new_domain");
164+
```
165+
Sets an new domain.
166+
167+
#### get_domain()
168+
```PHP
169+
$element_iot->get_domain();
170+
```
171+
Returns the current domain.
172+
173+
### How to Setup anything else?
174+
If you want to setup curl you can do this or other defaults on the attributes in the class or an proxy can also set during the initialization of the object.

0 commit comments

Comments
 (0)