I am trying different exchange rate sources, but there is one I have problems with:
https://www.estadisticasbcra.com/api/documentacion
I have tried this:
export async function fnGetOficialARS(){
let key = "MY_KEY. You can get one if you want from https://www.estadisticasbcra.com/api/registracion";
let strUrl = "https://api.estadisticasbcra.com/usd_of"
const headers = { 'Authorization': 'BEARER ' + key,
'Content-Type': 'application/json' };
var options = {
'method': 'get',
'headers': headers
}
let objResult = await fetch(strUrl, options)
if (objResult.ok) {
console.log("objResult =" + JSON.stringify(objResult ));
}
}
Instead of the, documented, expected response like so:
[{"d":"2003-01-02","v":10501},{"d":"2003-01-03","v":10505},{"d":"2003-01-06","v":10564},{"d":"2003-01-07","v":10605},{"d":"2003-01-08","v":10652},{"d":"2003-01-09","v":10663},{"d":"2003-01-10","v":10645},{"d":"2003-01-13","v":10664},{"d":"2003-01-14","v":10693} .... ]
I get this:
{"url":"https://api.estadisticasbcra.com/usd_of","status":200,"statusText":"OK","headers":{"_headers":{"date":["Mon, 31 Aug 2020 18:48:09 GMT"],"content-type":["application/json; charset=UTF-8"],"transfer-encoding":["chunked"],"connection":["close"],"access-control-allow-credentials":["true"],"access-control-allow-headers":["Authorization"],"access-control-allow-origin":["https://estadisticasbcra.com"],"access-control-expose-headers":["FooBar"],"x-xss-protection":["1; mode=block"],"x-frame-options":["SAMEORIGIN"]}},"ok":true,"body":{"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":{"data":{"type":"Buffer","data":[91,123,34,100,34,58,34,50,48,48,50,45,48,51,45,48,52,34,44,34,118,34,58,50,46,48,49,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,48,53,34,44,34,118,34,58,49,46,57,57,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,48,54,34,44,34,118,34,58,50,46,48,53,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,48,55,34,44,34,118,34,58,50,46,49,52,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,48,56,34,44,34,118,34,58,50,46,50,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,49,49,34,44,34,118,34,58,50,46,50,53,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,49,50,34,44,34,118,34,58,50,46,51,55,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,49,51,34,44,34,118,34,58,50,46,51,51,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,49,52,34,44,34,118,34,58,50,46,51,55,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,49,53,34,44,34,118,34,58,50,46,51,52,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,49,56,34,44,34,118,34,58,50,46,51,50,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,49,57,34,44,34,118,34,58,50,46,51,56,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,50,48,34,44,34,118,34,58,50,46,52,51,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,50,49,34,44,34,118,34,58,50,46,51,57,125,44,123,34,100,34,58,34,50,48,48,50,45,48,51,45,50,50,34,44,34,118,34,58,50,46,53,55,125,44,123,34,100,34,58,34,50,48,48,50,45,4
and some more garbage.
What am I doing wrong?