Getdata value "after" not URL encoded
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Start in src/Zendesk/API/Traits/Utility/Pagination/CbpStrategy.php at line 53 and reproduce the sections iterator request that sends the page[after] cursor. Trace how that value reaches Zendesk\API\HttpClient::get, then verify the cursor is accepted without requiring callers to encode it themselves. Consider the stated compatibility concern around encoding all query parameters.
Written by the indexing model from the issue text.
Description
When trying to do foreach ($zendesk->helpCenter->sections()->iterator() as $section) I get the error
Zendesk\API\Exceptions\ApiResponseException Client error: `GET https://<subdomain>.zendesk.com/api/v2/help_center/sections.json?page%5Bsize%5D=100&page%5Bafter%5D=aQQAAAAAAAAAZFh7/mcAAAAAaR13Wko+GAAA` resulted in a `400 Bad Request` response:
{"errors":[{"code":"InvalidPaginationParameter","title":"Invalid cursor"}]}
[details] {"errors":[{"code":"InvalidPaginationParameter","title":"Invalid cursor"}]}.
If I urlencode the page[after] value I get a working response. Or adding urlencode on this line https://github.com/zendesk/zendesk_api_client_php/blob/a6d5fc39c46c63a79578ed6b47635271c401fb2b/src/Zendesk/API/Traits/Utility/Pagination/CbpStrategy.php#L53.
This is likely a more widespread problem, so might want to look at encoding all query params sent to Zendesk\API\HttpClient::get, but that would be a breaking change since that is a public method.
An entirely different approach would be to use the meta.next value in the response instead of the meta.after value.
- Dominant language
- PHP
- Stars
- 344
- Forks
- 247
- Avg merge
- 27m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zendesk/zendesk_api_client_php
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
zendesk/zendesk_api_client_php#565 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 50/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
All issues in zendesk/zendesk_api_client_php
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-api#45 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RSS-Bridge/rss-bridge#5098 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
phingofficial/phing#2025 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
silverstripe/developer-docs#911 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100