16.02.2023, 08:01
hello, esios change the header for autentification in their API, from
to (https://apip.esios.ree.es/doc/index.html)
In the script of this post I try to change:
but, the return code is 401, error with authentification
Anyone was able to update the request to new way?
thanks for your help
Code:
curl "https://api.esios.ree.es/indicators" -X GET
-H "Accept: application/json; application/vnd.esios-api-v1+json"
-H "Content-Type: application/json" -H "Host: api.esios.ree.es"
-H "Authorization: Token token=\" 96c56fcd69dd5c29f569ab3ea9298b37151a1ee488a1830d353babad3ec90fd7\""
-H "Cookie: "
Code:
curl "https://api.esios.ree.es/archives" -X GET \
-H "Accept: application/json; application/vnd.esios-api-v1+json" \
-H "Content-Type: application/json" \
-H "x-api-key:\"96c56fcd69dd5c29f569ab3ea9298b37151a1ee488a1830d353babad3ec90fd7\"" \
In the script of this post I try to change:
Quote:--Token=('Token token=\34'..token..'\34')
Token=('\34'..token..'\34')
Code:
body, code, hdrs, stat = https.request ({ --Llamada HTTP formada por URL+metodo+cabecera
url = url;
method = 'GET';
headers = {
['Accept'] = 'application/json; application/vnd.esios-api-v1+json';
['Content-Type'] = 'application/json';
['Host'] = 'api.esios.ree.es';
-- ['Authorization'] = Token;
['x-api-key'] = Token;
['Cookie'] = '';
};
source = ltn12.source.string(payload);
sink = ltn12.sink.table(response_body);
})
but, the return code is 401, error with authentification
Anyone was able to update the request to new way?
thanks for your help