-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new service to handle multi entity levels #8
base: master
Are you sure you want to change the base?
Conversation
7f8e192
to
9ed0382
Compare
Hi @ca-dsgn Could you take a look? This is minimal effort to cover almost all endpoints of the Zoho desk API. However for subtypes entities it requires to set the path and bind the value to interpolate. I will document it but basically it means that you can tell the path: "tickets/{ticket_id}/threads/{thread_id}" and bind an array: ['ticket_id'=> 23, 'thread_id' => 8] |
Hi @stefnats I'd love to get your feedback too! |
Hi @thomas-kl1, I just pulled your branch develop-service and tried to understand how to update my code. I saw, that you gitignored your /docs/sample/code/test.php file. Could you update the sample code for your enhancement, so that I can a better understanding of what to do for fetching a thread of a ticket? Thank you in advance. Best, |
@ca-dsgn in your case you can use it as following: $criteriaBuilder = new ListCriteriaBuilder();
$criteriaBuilder->setFields(['id','subject', 'email', 'description','webUrl']);
$ticketList = $gateway->getServiceFactory()->listOperation('tickets')->getList($criteriaBuilder->create());
$threadList = $gateway->getServiceFactory()->listOperation('threads', 'tickets/{ticket_id}/threads')->getList($criteriaBuilder->create(), ['ticket_id' => $ticketId]); |
@ca-dsgn I've added some sample so you can use them for you tests. Let me know if everything works fine |
@thomas-kl1 I tried this code snippet to get the list of full threads (of a ticket): $criteriaBuilder = new ListCriteriaBuilder();
$ticketThreads = $gateway->getServiceFactory()->listOperation('threads', 'tickets/'.$params["ticket_id"].'/threads')->getList($criteriaBuilder->create(), [
'ticket_id' => $params["ticket_id"]
]); I am getting this error: I tried to pass a field entityType (entity_type) next to ticket_id, but it seems that this needs to be passed at a different place. Do you have any ideas? Best, |
@ca-dsgn my bad! Sorry I have a little access to dev currently and did a little update from my phone. Could you pull and tray again? |
@thomas-kl1 I am getting the list of threads now (but like before just with the short summary). Do I have to make a seperate call for each thread to get the full details of a thread? If so, could you give an example for this as well? |
I updated my code now to iterate over all threads and request the detailed thread for each: $serviceFactory = $gateway->getServiceFactory();
foreach($ticketThreads as $thread) {
$data = $thread->toArray();
$thread_id = $data["id"];
$threadDetail = $serviceFactory->readOperation('threads', 'tickets/'.$params["ticket_id"].'/threads/'.$thread_id.'',[
"ticket_id" => $params["ticket_id"],
"thread_id" => $data["id"]
]);
print_r($threadDetail);
} But the object I am getting now (print_r) has no detailed values in it. Do I have to pass anything else to receive more fields in the result? |
Hi @ca-dsgn , sorry for the late reply. In order to pull the threads list you have to use this call:
Regarding "/tickets/{ticket_id}/sendReply" it should be used like the threads, so:
|
@ca-dsgn in order to read a thread:
|
Hi @thomas-kl1, no worries - I am very happy that you answered my question. I tried to create a ticket reply, but I am not sure what the $replyDataObject is as well as the $ticketDataObject. Could you give an extended example with those variables set? |
@thomas-kl1 I already did that (as mentioned in my comment from Dec 16 last year) but the response object does not have any detailed values in it. I tried to use the toArray() method on the responseObject - but that didn't work. Could you give a example on how to fetch the full thread text from the responseObject? |
@thomas-kl1 Just wanted to kindly reask you for my questions on top. Thank you very much in advance. |
Hi, thank you for your patience, I don't have much time to work on this side-project. |
Reading https://desk.zoho.com/DeskAPIDocument#Threads#Threads_Getathread and https://desk.zoho.com/DeskAPIDocument#Include seems you can include specific fields from the API to be fetched along the response. |
I just figured out that you actually create the readService but never call the get method that will fetch the entity from the API. Try with the following: $serviceFactory = $gateway->getServiceFactory();
$readOperation = $serviceFactory->readOperation('threads', 'tickets/{ticket_id}/threads/{thread_id}');
foreach($ticketThreads as $thread) {
$threadDetail = $readOperation->get(['ticket_id' => $params['ticket_id'], 'thread_id' => $thread->getEntityId()]);
print_r($threadDetail);
} And if you want to use the include parameter e.g: the plainText field: $serviceFactory = $gateway->getServiceFactory();
$readOperation = $serviceFactory->readOperation('threads', 'tickets/{ticket_id}/threads/{thread_id}');
foreach($ticketThreads as $thread) {
$threadDetail = $readOperation->get(['ticket_id' => $params['ticket_id'], 'thread_id' => $thread->getEntityId()], ['include' => 'plainText']);
print_r($threadDetail);
} |
No description provided.