Schon wieder abgelaufen?
Code: Alles auswählen
{"error":"invalid_token","error_description":"The access token provided has expired"}
(Also erstmal ohne das JSON Parsing)
Moderator: Co-Administratoren
Schon wieder abgelaufen?
Code: Alles auswählen
{"error":"invalid_token","error_description":"The access token provided has expired"}
Code: Alles auswählen
string token = "bd537133e084112f82772c327211d357b5ce21c0";
string url = "https://interop.ondilo.com/api/customer/v1/pools/48640/lastmeasures?types[]=temperature";
string curlcmd = 'curl -v '
+ url
+ ' -H "Authorization: Bearer ' + token + '"'
+ ' -H "Accept: application/json"'
+ ' -H "Accept-Charset: utf-8"'
+ ' -H "Accept-Encoding: gzip, deflate"'
+ ' -H "Content-Type: application/x-www-form-urlencoded"';
string stdout; string stderr;
system.Exec(curlcmd, &stdout, &stderr);
WriteLine("stdout:\n"#stdout); WriteLine("\nstderr:\n"#stderr);
Code: Alles auswählen
stdout:
[{"data_type":"temperature","value":16.4,"value_time":"2023-01-20T09:15:11+0000","is_valid":true,"exclusion_reason":null}]
stderr:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [108 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [4285 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [589 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
> GET /api/customer/v1/pools/48640/lastmeasures?types[]=temperature HTTP/1.1
> Host: interop.ondilo.com
> User-Agent: curl/7.61.1
> Authorization: Bearer bd537133e084112f82772c327211d357b5ce21c0
> Accept: application/json
> Accept-Charset: utf-8
> Accept-Encoding: gzip, deflate
> Content-Type: application/x-www-form-urlencoded
>
{ [5 bytes data]
< HTTP/1.1 200 OK
< Date: Fri, 20 Jan 2023 09:34:42 GMT
< Server: Apache/2.4.41 (Ubuntu)
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept, Origin, Authorization
< Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
< Cache-Control: no-store, no-cache, must-revalidate, max-age=0
< Cache-Control: post-check=0, pre-check=0
< Pragma: no-cache
< Content-Length: 122
< Content-Type: application/json
<
{ [122 bytes data]
100 122 100 122 0 0 428 0 --:--:-- --:--:-- --:--:-- 426
100 122 100 122 0 0 426 0 --:--:-- --:--:-- --:--:-- 426
Code: Alles auswählen
=== Output V1.11 ===
Ondilo | data-type = 'temperature'
Ondilo | value = '16.4'
Ondilo | value-time = '2023-01-20T09 15 11+0000'
Ondilo | is-valid = 'true'
Ondilo | exclusion-reason = 'null'
Hier das Ondilo Modul habe ich geschrieben für einen anderen User, kannst Du gerne als Vorlage verwenden bzw. für die CCU adaptieren und umschreiben. Wie Du das mit OAuth2 geregelt bekommst, weis ich aber nicht, da ich nicht die CCU für solche Dinge zur Authentifizierung nutzte, man braucht ja eine feste Redirect URL. Wie man das mit einer CCU alleine lösen soll, weis ich beim besten Willen auch nicht.