-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
I'm trying to use this library to interact with the Zendesk API. Using the following code, I'm requesting the Users endpoint with some query params in the URL ?role[]=agent&role[]=admin
However, when I have this code I get an error response back from Zendesk saying the params aren't correct.
Request to API
$req = Zttp::withHeaders([
'Authorization' => 'Bearer MYTOKEN',
])->get('https://MYSUBDOMAIN.zendesk.com/api/v2/users.json?role[]=agent&role[]=admin');
dd($req->json());
Error from API
^ array:1 [▼
"error" => array:2 [▼
"title" => "Invalid attribute"
"message" => "You passed an invalid value for the role attribute. Invalid parameter: role must be a string from api/v2/users/index"
]
]
If I look at the URL which Zttp actually sends it appears as:
https://MYSUBDOMAIN.zendesk.com/api/v2/users.json?role%5B0%5D=admin&role%5B1%5D=agent
I have also tried using:
$req = Zttp::withHeaders([
'Authorization' => 'Bearer MYTOKEN',
])->get('https://MYSUBDOMAIN.zendesk.com/api/v2/users.json', [
'role' => 'admin',
'role' => 'agent',
]);
and
$req = Zttp::withHeaders([
'Authorization' => 'Bearer MYTOKEN',
])->get('https://MYSUBDOMAIN.zendesk.com/api/v2/users.json', [
'role[]' => 'admin',
'role[]' => 'agent',
]);
Using this approach, Zendesk get's only one of the parameters.
Does anyone have any suggestions how I can get this working? Via the query params is the only way Zendesk will accept.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels