zendesk / zendesk_api_client_php

Official Zendesk API v2 client library for PHP
336 stars 259 forks source link

Can't find user by ID #348

Closed DeanWard closed 7 months ago

DeanWard commented 7 years ago

Hello,

I'm trying to get the name of the author for comments. Using the SDK I can't find a way to simply load user information based on ID as in the show user endpoint from the api (/api/v2/users/{id}.json)

I've tried searching with id:author_id but that returns nothing.

Is there something obvious I'm missing?

donjose24 commented 7 years ago

Have you tried sideloading? According to the readme:

tickets = $client->tickets()->sideload(['users', 'groups'])->findAll();

Just change it to

comments()->sideload(['users']);

So you can get the associateduser object together with the comments https://developer.zendesk.com/rest_api/docs/core/side_loading