Answer the question
In order to leave comments, you need to log in
Getting a specific variable from a Node.js get request?
I'm just learning and I can somehow express myself incorrectly, but I hope you understand me and help.
There is a curl request:
curl -X GET "url" -H "accept: text/plain"
Which I remade into a Node.js request:
var request = require('request');
var headers = {
'accept': 'text/plain'
};
var options = {
url: 'url',
headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
{"countries":[{"countryId":643,"countryCode":"ru","unitId":395,"date":"2022-04-18T00:00:00","stationaryRevenue":63453.00,"stationaryOrderCount":151,"deliveryRevenue":141308.00,"deliveryOrderCount":107,"revenue":204761.00,"orderCount":258,"avgCheck":793.6472868217054263565891473}],"errors":[]}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question