Hi all,
I have spent too much time on this, searching and searching and it is not working.
i would like to catch data from https:// agsi.gie.eu/#/
When logged I can see maunual API but I can not make it works.
I get information:
Your key: 709a7d013e4fda8f3e21166c33a1a691
curl --header "x-key: 709a7d013e4fda8f3e21166c33a1a691
and listing of API
https:// agsi.gie.eu/api/eic-listing/SSO/SSO_EIC.xls
I want to get into
https:// agsi.gie.eu/api/data/21X000000001160J/DE
which is JSON with gas storage information on daily history. Don`t mind that variables already been declared.
I get: error: Uncaught SyntaxError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'x-key:' is not a valid HTTP header field name.
What is proper way to do it?
Many thanks for help
With $
let urls1="https://agsi.gie.eu/api/data/53XPL000000OSMP5/PL";
let apiKey = "709a7d013e4fda8f3e21166c33a1a691";
$.ajax(
{
headers: {"x-key:": apiKey},
url:urls1,
dataType: "json",
success: function (data) {console.log(data);},
error: function (msg) { console.log(msg); }
}) ;
And with XMLHttpRequest
let urls1="https://agsi.gie.eu/api/data/53XPL000000OSMP5/PL";
let apiKey = "709a7d013e4fda8f3e21166c33a1a691";
const xhr = new XMLHttpRequest();
xhr.addEventListener("load", function() {
if (xhr.status === 200) {
console.log(xhr.response); }
});
xhr.addEventListener("error", function() {
console.log("ERROR", xhr.readyState, " ",xhr.status);
});
xhr.open("GET", urls1);
xhr.setRequestHeader("x-key:",apiKey);
xhr.send();