zendesk / zendesk_api_client_php

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

When querying helpCenter articles, the route name disregards section filter. #399

Closed Spittal closed 4 months ago

Spittal commented 6 years ago

Hello there, I did a little digging into the Article resource class and found out that when requesting articles within a specific section that it ignore those filters.

Example

$client->helpCenter->sections(12345)->articles()->setLocale('en-us')->findAll();

will actually make a get request to the url

help_center/en-us/articles.json

as opposed to

help_center/en-us/sections/12345/articles.json

Where the issue is

I can track down the problem to this everything that happens inside of this catch block:

https://github.com/zendesk/zendesk_api_client_php/blob/master/src/Zendesk/API/Traits/Resource/FindAll.php#L24

As you can see, if it throws a RouteException then it just prints out the resource name with .json appended to it and doesn't go through to process of building up the URL correctly.

Workaround

As a temporary work around I have just executed the get method on the httpClient manually as so

$client->get('/api/v2/help_center/en-us/sections/12345/articles.json'));

Let me know if you need any other information.

ecoologic commented 5 months ago

Hi,

thank you for your request, are you still interested in a solution for this issue?

ecoologic commented 4 months ago

Closing due to inactivity. Re-open if needed.