Recent searches
No recent searches
Sending data to external API - 404 Proxy Not Allowed
Posted Jan 14, 2021
Hello!
So, I´m trying to POST information to an external API and I only receive 404 Proxy Not Allowed doesn´t matter what I try. I already read a lot of zendesk tutorials, and many others issues similar to mine but it doesn´t resolve my problem. Funny because the GET requests are working fine. But this POST one doesn´t.
That´s my request:
function sendNewClaim() {
var d = new Date();
var dtocomunic = d.toISOString();
var y = new Date($("#dtocorrencia").val());
var dtocorrencia = y.toISOString();
var coverages = getCoverages();
var settings = {
headers: {"Authorization": "Basic {{setting.token}}",
secure : true,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
coverages: [JSON.parse(coverages)],
contract_id: $("#idcontract").val(),
opening_at: dtocomunic,
happening_at: dtocorrencia,
person_id: $("#idperson").val()
//description: $("#descricaoTextarea").val(),
//personal_damage: $("#txtdanospessoais").val(),
//financial_damage: $("#txtdanosmateriais").val(),
//comunicante
})
}};
client.request(settings).then(
function(data) {
//success_modal();
},
function (response) {
//error_modal();
}
);
// client.invoke('destroy');
}
That´s the payload :
data: "{"coverages":[{"coverage_id":"49ba7f74-0ed5-4d92-85c6-d56f139e0bf7"}],"contract_id":"c62f679e-c570-410e-a660-cffe1c4bd003","opening_at":"2021-01-14T19:02:58.451Z","happening_at":"2021-01-12T00:00:00.000Z","person_id":"c4db4560-2700-44af-a441-d1f43de533fa"}"
data: "{"coverages":[{"coverage_id":"49ba7f74-0ed5-4d92-85c6-d56f139e0bf7"}],"contract_id":"c62f679e-c570-410e-a660-cffe1c4bd003","opening_at":"2021-01-14T19:02:58.451Z","happening_at":"2021-01-12T00:00:00.000Z","person_id":"c4db4560-2700-44af-a441-d1f43de533fa"}"
Sorry my bad english, I´m brazilian!
I tried support here in Brazil but they don´t support integrations to external API´s. lol
I tried support here in Brazil but they don´t support integrations to external API´s. lol
Thank you for your time
0
2
2 comments
Kaia
Hello, it seems that your external API is refusing the CORS request that you are making via Zendesk's proxy server (cors:false is the default). You may want to try cors:true if the external API supports direct cross-origin calls.
Cheers,
Korak
0
IZA
In my case, I forgot to close the } on the HEADER lol problem solved thank you
0