I´m trying to use Data Storage functionality of Freshdesk and it returns an error. I´m following this example.
My code to store the data is:
var ticket = domHelper.ticket.getTicketInfo().helpdesk_ticket;
var dataTicket = {
'ticketId': ticket.display_id,
'osNumber': idOS
};
var dbKey = "ticket:" + ticket.display_id;
this.$db.set(dbKey, dataTicket).done(function(data) {
if(data.Created) {
console.log("Dados de OS salvos com sucesso.");
}
}).fail(function(errorData) {
alert("Falha ao salvar dados de OS.");
});
This code works fine. To retrieve that data, I'm using the code below:
var ticket = domHelper.ticket.getTicketInfo().helpdesk_ticket;
var dbKey = "ticket:" + ticket.display_id;
this.$db.get(ticket.display_id).done(function(data) {
self.loadData(data);
}).fail(function(errorData) {
console.log("Falha ao recuperar dados de OS.");
});
The key to retrieve the data is the same that I use to store that data, but it always enter in fail function. It tells me that there isn't data (return 404 error of the API).