The skeleton for making API call
var requestOptions =
{
url : "http://yourapi.com/api/path",
method : "GET", json : {},
qs : { offset : 20
} };
request(requestOptions, function(err, response, body) {
if (err) {
console.log(err);
} else if (response.statusCode === 200) {
console.log(body);
} else {
console.log(response.statusCode); }
});
{
url : "http://yourapi.com/api/path",
method : "GET", json : {},
qs : { offset : 20
} };
request(requestOptions, function(err, response, body) {
if (err) {
console.log(err);
} else if (response.statusCode === 200) {
console.log(body);
} else {
console.log(response.statusCode); }
});
Nhận xét
Đăng nhận xét