Coronavirus monitor

PAID
By avalon | Updated a month ago | Health and Fitness
Popularity

0.5 / 10

Latency

48,406ms

Service Level

32%

Health Check

N/A

Back to All Discussions

GET random_masks_usage_instructions

Rapid account: Gaut 9 A 8 M
gaut9a8m
4 years ago

This request type is returning a JPEG/PNG directly an image. Instead we , should get a url to image.
please update it or let me know how to handle this response.
Thank you.

Rapid account: Jaikumarsingh 1908
jaikumarsingh1908 Commented 4 years ago

Hi,can anyone tell me how I can solve this problem by using Nodejs- axios request ?

Rapid account: Andhoule 15
andhoule15 Commented 4 years ago

You can solve this problem by using ajax request as follow >>>>

function getImg (){
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.responseType = ‘arraybuffer’;

xhr.onload = function (e) {
if (this.readyState === this.DONE) {
var uInt8Array = new Uint8Array(this.response);
var i = uInt8Array.length;
var binaryString = new Array(i);
while (i–)
{
binaryString[i] = String.fromCharCode(uInt8Array[i]);
}
var data = binaryString.join(’’);

var base64 = window.btoa(data);
var src ="data:image/png;base64," + base64;

/*  do something like : */ $('img').attr('src', src);

console.log(src);
}
};

xhr.open(“GET”, “https://coronavirus-monitor.p.rapidapi.com/coronavirus/masks.php”, true);
xhr.setRequestHeader(“x-rapidapi-host”, “coronavirus-monitor.p.rapidapi.com”);
xhr.setRequestHeader(“x-rapidapi-key”, “xxxxxxxxxxxx your API”);

xhr.send(data);

}
getImg();

/* good luke 😉*/

Rapid account: Astsiatsko
astsiatsko Commented 4 years ago

Hi, ok I will do what you need. Thanks

Join in the discussion - add comment below:

Login / Signup to post new comments