0
My code:
var data = JSON.stringify(orderNo)
options.path = "/1/sales?merchantOrderId=" + orderNo
options.method = 'GET';
console.log(options)
var req = https.request(options, function (res) {
res.on('data', function (chunk) {
var retornoIds = iconv.decode(chunk, 'utf-8');
console.log(retornoIds)
}
});
});
req.write(data)
req.on('error', function (err) {
callback(err);
});
req.end();
My options:
{ hostname: 'apisandbox.cieloecommerce.cielo.com.br',
port: 443,
secureProtocol: 'TLSv1_method',
encoding: 'utf-8',
headers:
{ 'Content-Type': 'application/json',
MerchantId: 'xxxxxxxxxx',
MerchantKey: 'xxxxxxxxx' },
path: '/1/sales?merchantOrderId=VE805051701',
method: 'GET' }
I don’t know what’s wrong
{"Message":"The requested resource does not support http method 'GET'."}
The message already says it all Erick. Have you checked if the end-point accepts GET at this url? A tip is to test it first with Postman
– BrTkCa
I am following the documentation of Cielo, and there says that to make the query I must do a get exactly like this, this was what left me very confused, mainly because last week was working, I will try to use the Postman.
– Erick Zanetti
I found my error, the hostname is like 'apisandbox.cieloecommerce.Cielo.com.br', this is for query requests should be 'apiquerysandbox.cieloecommerce.Cielo.com.br'.
– Erick Zanetti
How nice @Erickzanetti =]
– BrTkCa