Ricerche recenti


Nessuna ricerca recente

Pull Custom fields from Ticket API



Data ultimo post: 12 apr 2023

I am not able to find what is the name of field on API level and how to pull it via rest API request from tickets API.


0

3

3 commenti

Hey Aditee,

I think what Ahmed is suggesting is that you pull the ticket and then parse the response from there. 

Here's a small example for node.js
 
var axios = require("axios");

var config = {
method: "get",
url: "https://example.zendesk.com/api/v2/tickets/123",
headers: {
Authorization:
"Basic BASE64-encoded-credentials",
},
};

axios(config)
.then(function (response) {
// Pulls the custom field array out of the response
let customFieldArray = response.data.ticket.custom_fields;

//Finds the field you want to return from the array.
let myField = customFieldArray.find((x) => x.id === 12345);
console.log(JSON.stringify(myField));
})
.catch(function (error) {
console.log(error);
});

Hope this helps,

1


Hi Ahmed Zaid,

Yes I am able to pull the custom field id and values from it ..but I am not able to link it up with respective ticket id..it is showing all the possible values for all the tickets.It is hard to separate it. 

0


I am trying to make an API Call that will give me an answer on a ticket number, but return 1 of the custom fields as a result.

Zendesk - Individual Ticket Get
https://domain.zendesk.com/api/v2/tickets/59443.json 

This will pull the ticket number 59443 and all it's details. Though I wanted to only get the custom field of 360014914040 in my system.

I can call it by itself, https://domain.zendesk.com/api/v2/ticket_fields/360014914040.json, but of course that just tells me the type of field it is.

I was hoping I could combine both API's to pull a repose of Ticket 59443 and just get back that custom field? 

The issue is that when I pull just that ticket, all of the custom fields come in under a custom_field and hard to seperate it 

0


Accedi per lasciare un commento.

Non hai trovato quello che cerchi?

Nuovo post