Closed dbuskariol closed 5 years ago
It looks like the gem is not actually passing the role
through to the API
GET /api/v2/users.json?page=1&per_page=1 HTTP/1.1
User-Agent: Ruby/2.4.1 (x86_64-linux; ruby) Zendesk2/1.12.0 Faraday/0.15.2
Authorization: Basic <snip>
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Host: github.zendesk.com
@dbuskariol
You need to use the search
collection method to obtain filtered results.
z.users.search('role' => 'foo')
I, [2018-07-10T09:00:20.030336 #99393] INFO -- : get => https://x.zendesk.com/api/v2/search.json
D, [2018-07-10T09:00:20.030403 #99393] DEBUG -- request: User-Agent: " Ruby/2.5.1 (x86_64-darwin17; ruby) Zendesk2/1.12.0 Faraday/0.13.1\n"
Authorization: "Basic XYZ"
Content-Type: "application/json"
D, [2018-07-10T09:00:20.030429 #99393] DEBUG -- request.body: {"query":"role:foo type:user"}
I, [2018-07-10T09:00:20.511346 #99393] INFO -- : 200 <= https://x.zendesk.com/api/v2/search.json
D, [2018-07-10T09:00:20.511462 #99393] DEBUG -- response: server: "nginx"
date: "Tue, 10 Jul 2018 16:00:20 GMT"
content-type: "application/json; charset=UTF-8"
transfer-encoding: "chunked"
connection: "close"
x-frame-options: "SAMEORIGIN"
cache-control: "max-age=10, private"
x-rate-limit: "700"
x-rate-limit-remaining: "697"
strict-transport-security: "max-age=31536000;"
x-content-type-options: "nosniff"
D, [2018-07-10T09:00:20.511501 #99393] DEBUG -- response.body: {"results":[],"facets":null,"next_page":null,"previous_page":null,"count":0}
see:
So based off the Zendesks API docs, I should be able to pass in
role
key with value ofagent
,admin
orend_user
. I am trying the following:But it's still only giving me all users. I can tell this as the
next_page
url is the standardhttps://{subdomain}.zendesk.com/api/v2/users.json?page=2
with way too high of acount
, instead of the expectedhttps://{subdomain}.zendesk.com/api/v2/users.json?page=2&role=agent&per_page=1
.Am I missing something here?