andreb
February 25, 2019, 12:15pm
1
Gostaria de saber se é possível atualizar o status e também um anexo de um pedido através da Orders API.
Alterar o anexo seria por exemplo uma mensagem que é adicionada ao produto pelo cliente e poder ser alterada após o pagamento caso haja algum erro ortográfico ou algo assim.
andreb
February 25, 2019, 7:02pm
2
Quanto à atualizar o status do pedido eu consegui da seguinte forma:
var settings = {
"url": "https://{{store_name}}.vtexcommercestable.com.br/api/oms/pvt/orders/{{order_id}}/{{order_status}}",
"method": "POST",
"timeout": 0,
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"X-VTEX-API-AppToken": "{{app_token}}",
"X-VTEX-API-AppKey": "{{app_key}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Porém ainda falta conseguir alterar o anexo (texto) do pedido. Tentei usar o atributo 'changes' mas está retornando erro 400
var od_json = {
"textofrase": 'Test text',
};
var settings = {
"url": "https://{{store_name}}.vtexcommercestable.com.br/api/oms/pvt/orders/{{order_id}}/changes",
"method": "POST",
"timeout": 0,
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"X-VTEX-API-AppToken": "{{app_token}}",
"X-VTEX-API-AppKey": "{{app_key}}"
},
"data": JSON.stringify(od_json),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Segue foto do anexo que estou tentando alterar: