Wiki source code of Eniris API
Last modified by Bart Verheecke on 2024/01/15 21:46
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | = **Eniris Authentication APIs** = | ||
2 | |||
3 | Eniris provides Authentication APIs, facilitating access through both MQTT and HTTPS protocols. Detailed documentation and interactive features for these APIs are available at the following links: | ||
4 | |||
5 | |||
6 | * MQTT Authentication API: [[Click here>>url:https://authentication.mqtt.eniris.be/docs/]] | ||
7 | * HTTPS Authentication API: [[Click here>>url:https://authentication.eniris.be/docs/#/Authentication/accesstoken]] | ||
8 | |||
9 | = **Eniris Metadata & Telemetry Query API** = | ||
10 | |||
11 | (% class="wikigeneratedid" %) | ||
12 | Additionally, Eniris offers a Metadata Query API, enabling users to retrieve telemetry-related data. The documentation for this API can be accessed via the following link: | ||
13 | |||
14 | [[https:~~/~~/api.eniris.be/docs/>>https://api.eniris.be/docs/]] | ||
15 | |||
16 | |||
17 | = **Telemetry Query API** = | ||
18 | |||
19 | Specifically for telemetry data, Eniris provides the Telemetry Query API. This API requires a POST request to the following URL: | ||
20 | |||
21 | POST [[https:~~/~~/neodata-ingress.eniris.be/v1/telemetry>>url:https://mailtrack.io/trace/link/c2390190c75533d9e9be1ec4a6ae3d683bb6e656?w=cGlldGVyQHNiLWNvbnRyb2xzLmJl&url=https%3A%2F%2Fneodata-ingress.eniris.be%2Fv1%2Ftelemetry&userId=6890914&signature=b44f95064e1a79ce]] | ||
22 | |||
23 | |||
24 | The following query parameters are mandatory when using the Telemetry Query API: | ||
25 | |||
26 | * u: Collector name | ||
27 | * db: Database | ||
28 | * rp: Retention policy | ||
29 | |||
30 | An example of a request to the Telemetry Query API might look like this: | ||
31 | |||
32 | {{code language="none"}} | ||
33 | https://neodata-ingress.eniris.be/v1/telemetry?u=klantennaam-ingress&db=klantennaam&rp=rp_one_m | ||
34 | {{/code}} | ||
35 | |||
36 | |||
37 | {{code language="json"}} | ||
38 | [ | ||
39 | { | ||
40 | "measurement": "exampleMetrics", | ||
41 | "time": "2023-08-02T10:00:00Z", | ||
42 | "tags": { | ||
43 | "serialNr": "aaaabbbbccccdddd" | ||
44 | }, | ||
45 | "fields": { | ||
46 | "maximumProductionPower_W": 2000 | ||
47 | } | ||
48 | } | ||
49 | ] | ||
50 | {{/code}} | ||
51 | |||
52 | |||
53 | [[image:api.png]] | ||
54 | |||
55 | |||
56 | = **Authorization Requirements** = | ||
57 | |||
58 | For accessing the Eniris APIs, it is crucial to include a valid Bearer authorization token. This token must be obtained by logging in as a user who is a member of the specific "CustomerName" role. Failure to provide a token associated with a user in the correct role will result in a 403 Forbidden response, accompanied by an error message indicating unauthorized access or incorrect permissions. | ||
59 | |||
60 | = **Server Response Codes** = | ||
61 | |||
62 | When interacting with Eniris APIs, the server can respond with a limited set of HTTP status codes, each indicating a specific type of response or error: | ||
63 | |||
64 | * 204 No Content: Success, but no content in the body. | ||
65 | * 400 Bad Request: Various formatting errors in the request. | ||
66 | * 403 Forbidden: Authentication issues or incorrect permissions. | ||
67 | * 404 Not Found: Attempts to write to an unknown namespace. | ||
68 | * 409 Conflict: Conflicts with the allowed data time range or stored field types. | ||
69 | * 422 Unprocessable Entity: Internal data type inconsistencies within the sent message. | ||
70 | |||
71 | |||
72 | = **Collection for postman** = | ||
73 | |||
74 | |||
75 | Below is a script for postman that helps handle the token generation. (see appendix) | ||
76 | |||
77 | |||
78 | [[attach:Influx via api.postman_collection.json||target="_blank"]] | ||
79 | |||
80 | = **Access timeseries data** = | ||
81 | |||
82 | |||
83 | |||
84 | [[image:1681128242876-647.png||height="151" width="535"]] | ||
85 | |||
86 | {{video url="https://youtu.be/zpwO8mQxvt4"/}} | ||
87 | |||
88 | |||
89 | = **Access a device (building/site)** = | ||
90 | |||
91 | GET [[https:~~/~~/api.eniris.be/v1/device?id=37142>>https://api.eniris.be/v1/device?id=37142]] | ||
92 | |||
93 | |||
94 | [[image:1632835483913-618.png]] | ||
95 | |||
96 | |||
97 | |||
98 | To edit a property, use POST: | ||
99 | |||
100 | |||
101 | [[image:1632835529574-890.png]] | ||
102 | |||
103 | = = |