Comments (9)
Hi Rafael, try created_at>2015-01-01
Em 26/10/2015 10:50, Rafael Foster [email protected] escreveu:
Hi There,
How do I filter the request?
I want to filter tickets creating (greather than) date like:
Ticket create more than 2015-09-01 and less than 2015-10-01;
How can I do that?
$tickets = $zendesk->tickets()->findAll(["created_at" => "2015-06"]);
And the search API is not documented, how do I use it?
There's some documentation to guide me?
I appreciate that!
Reply to this email directly or view it on GitHub:
#217
from zendesk_api_client_php.
I've done this befere without success.
The organization field is being filtered perfectly, but creation date doesn't.
If try this codes bellow:
$tickets = $zendesk->tickets()->findAll(["created_at" => "2015-01-07", "organization_id" => $orgID]);
and
$tickets = $zendesk->tickets()->findAll(["created_at>2015-01-07", "organization_id" => $orgID]);
also
$tickets = $zendesk->tickets()->findAll(["created_at>2015-01-07"]);
print_r($tickets);
....
It returns me all tickets, like:
[created_at] => 2015-06-03T13:52:39Z
[updated_at] => 2015-07-17T20:05:29Z
[type] => problem
[subject] => "loren ipson"
etc....
Any idea?
from zendesk_api_client_php.
Hi rafael,
i just figured out you're using the findAll() from tickets().In this case i would use ## $teste = $client->search(['query'=>"type:ticket created_at>2015-01-07"]); ##
try it, working here
Date: Mon, 26 Oct 2015 08:23:05 -0700
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [zendesk_api_client_php] Filter and search request (#217)
I've done this befere without success.
The organization field is being filtered perfectly, but creation date doesn't.
If try this codes bellow:
$tickets = $zendesk->tickets()->findAll(["created_at" => "2015-01-07", "organization_id" => $orgID]);
and
$tickets = $zendesk->tickets()->findAll(["created_at>2015-01-07", "organization_id" => $orgID]);
also
$tickets = $zendesk->tickets()->findAll(["created_at>2015-01-07"]);
print_r($tickets);
....
It returns me all tickets, like:
[created_at] => 2015-06-03T13:52:39Z
[updated_at] => 2015-07-17T20:05:29Z
[type] => problem
[subject] => "loren ipson"
etc....
Any idea?
—
Reply to this email directly or view it on GitHub.
from zendesk_api_client_php.
Thanks for your response @RaFeNiX
Unfortunally, it still not working.
I've copied your entire line and add it to my code.
The API doesn't returns me any erros.
But it return this:
Zendesk\API\Resources\Core\Search Object
(
[resourceName:protected] => search
[objectName:protected] => search
[objectNamePlural:protected] => searches
[client:protected] => Zendesk\API\HttpClient Object
(
[auth:protected] => Zendesk\API\Utilities\Auth Object
(
[authStrategy:protected] => basic
[authOptions:protected] => Array
(
[username] => [email protected]
[token] => 8Gasdsadsada4GCBAuRiRLitJCcj6wbHNLWPQEhhTcl3epIfWK
)
)
[subdomain:protected] => EXAMPLE
[username:protected] => [email protected]
[scheme:protected] => https
[hostname:protected] => zendesk.com
[port:protected] => 443
[apiUrl:protected] => https://EXAMPLE.zendesk.com:443/api/v2/
[apiVer:protected] => v2
[sideload:protected] =>
[debug:protected] => Zendesk\API\Debug Object
(
[lastRequestBody] =>
[lastRequestHeaders] => Array
(
[Host] => Array
(
[0] => EXAMPLE.zendesk.com
)
[Accept] => Array
(
[0] => application/json
)
[Content-Type] => Array
(
[0] => application/json
)
[User-Agent] => Array
(
[0] => ZendeskAPI PHP 2.0.0
)
)
[lastResponseCode] => 200
[lastResponseHeaders] => Array
(
[Server] => Array
(
[0] => nginx
)
[Date] => Array
(
[0] => Mon, 26 Oct 2015 16:28:05 GMT
)
[Content-Type] => Array
(
[0] => application/json; charset=UTF-8
)
[Content-Length] => Array
(
[0] => 5349
)
[Connection] => Array
(
[0] => keep-alive
)
[Status] => Array
(
[0] => 200 OK
)
[X-Zendesk-API-Version] => Array
(
[0] => v2
)
[X-Frame-Options] => Array
(
[0] => SAMEORIGIN
)
[Strict-Transport-Security] => Array
(
[0] => max-age=31536000;
)
[X-UA-Compatible] => Array
(
[0] => IE=Edge,chrome=1
)
[ETag] => Array
(
[0] => W/"46af5d3faec10f397298da25788aa75f"
)
[Cache-Control] => Array
(
[0] => must-revalidate, private, max-age=0
)
[X-Zendesk-Origin-Server] => Array
(
[0] => app13.pod4.sac1.zdsys.com
)
[X-Request-Id] => Array
(
[0] => 099b76e0-c9d2-4b66-cb0a-b8ca3a61dd58
)
[X-Runtime] => Array
(
[0] => 0.699089
)
[X-Rack-Cache] => Array
(
[0] => miss
)
[X-Zendesk-Request-Id] => Array
(
[0] => b23edeab94d1ca72b9c912adas
)
[X-Content-Type-Options] => Array
(
[0] => nosniff
)
)
[lastResponseError] =>
)
[guzzle] => GuzzleHttp\Client Object
(
[config:GuzzleHttp\Client:private] => Array
(
[handler] => GuzzleHttp\HandlerStack Object
(
[handler:GuzzleHttp\HandlerStack:private] => Closure Object
(
[static] => Array
(
[default] => Closure Object
(
[static] => Array
(
[default] => GuzzleHttp\Handler\CurlMultiHandler Object
(
[factory:GuzzleHttp\Handler\CurlMultiHandler:private] => GuzzleHttp\Handler\CurlFactory Object
(
[handles:GuzzleHttp\Handler\CurlFactory:private] => Array
(
[0] => Resource id #90
)
[maxHandles:GuzzleHttp\Handler\CurlFactory:private] => 50
)
[selectTimeout:GuzzleHttp\Handler\CurlMultiHandler:private] => 1
[active:GuzzleHttp\Handler\CurlMultiHandler:private] => 0
[handles:GuzzleHttp\Handler\CurlMultiHandler:private] => Array
(
)
[delays:GuzzleHttp\Handler\CurlMultiHandler:private] => Array
(
)
[_mh] => Resource id #93
)
[sync] => GuzzleHttp\Handler\CurlHandler Object
(
[factory:GuzzleHttp\Handler\CurlHandler:private] => GuzzleHttp\Handler\CurlFactory Object
(
[handles:GuzzleHttp\Handler\CurlFactory:private] =>
[maxHandles:GuzzleHttp\Handler\CurlFactory:private] => 3
)
)
)
[parameter] => Array
(
[$request] =>
[$options] =>
)
)
[streaming] => GuzzleHttp\Handler\StreamHandler Object
(
[lastHeaders:GuzzleHttp\Handler\StreamHandler:private] => Array
(
)
)
)
[parameter] => Array
(
[$request] =>
[$options] =>
)
)
[stack:GuzzleHttp\HandlerStack:private] => Array
(
[0] => Array
(
[0] => Closure Object
(
[parameter] => Array
(
[$handler] =>
)
)
[1] => http_errors
)
[1] => Array
(
[0] => Closure Object
(
[parameter] => Array
(
[$handler] =>
)
)
[1] => allow_redirects
)
[2] => Array
(
[0] => Closure Object
(
[parameter] => Array
(
[$handler] =>
)
)
[1] => cookies
)
[3] => Array
(
[0] => Closure Object
(
[parameter] => Array
(
[$handler] =>
)
)
[1] => prepare_body
)
)
from zendesk_api_client_php.
try this simple code.
include("./vendor/autoload.php");
use Zendesk\API\Client as ZendeskAPI;
$subdomain = "";
$username = "";
$token = "";
$client = new ZendeskAPI($subdomain, $username);
$client->setAuth('token', $token);
$tesrte = $client->search(['query'=>"type:ticket created_at>2015-10-20"]);
echo json_encode($tesrte);
from zendesk_api_client_php.
The json returns me empty.
Hey, maybe it could be the last version of API?
I've cloned this repo.
Which version are you using?
from zendesk_api_client_php.
On version 2 of the client things have changed quite a bit.
To achieve what you want, you would want a snippet like
$response = $client->search()->find('type:ticket created>=2015-09-01 created<2015-10-01');
Search is now a resource you can make calls on, similar to a ticket or a user. We wanted to keep this pattern consistent.
There definitely should be an example on search, will put that in the list of things to do.
For more documentation on using search there is https://developer.zendesk.com/rest_api/docs/core/search and https://support.zendesk.com/hc/en-us/articles/203663226
And a pro tip to test your query string easily is to try it out in the zendesk ui.
It also seems like you are using the version 1 way of making a search, if you are upgrading, there is a handy upgrade guide that can help you upgrade.
Please let me know if this works.
from zendesk_api_client_php.
Yeah! That's working now @miogalang
I really appreciate that!
Thanks for your help too @RaFeNiX
from zendesk_api_client_php.
Hey, am using php curl to execute my search query but It returns null everytime. Below is a snippet of my code:
$date="2018-09-01";
//$link = isset($link) ? $link : "https://$subdomain.zendesk.com/api/v2/$resource.json?created_at>=".$date;
$link = isset($link) ? $link : "https://$subdomain.zendesk.com/api/v2/search?query=type:user created_at=".$date;
while($link){
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERPWD, $email . ":" .$password);
$response = curl_exec($ch);
$output = json_decode($response);
var_dump($output);
$link = $output->next_page;
}
What am I doing wrong?
from zendesk_api_client_php.
Related Issues (20)
- PHP8 Error: array_merge() does not accept unknown named parameters HOT 1
- php 5.6 Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/clients/client1/web6/web/vendor/guzzlehttp/guzzle/src/HandlerStack.php on line 47 HOT 1
- Update Packagist with the new version HOT 3
- Unmerged PRs HOT 3
- Okta HOT 2
- Oktane22
- Add comment to ticket HOT 3
- FindAll method Ambiguity in Error Webhooks HOT 3
- No events API support? HOT 2
- Type error: Argument 1 passed to GuzzleHttp\Client::send()
- Allow any PSR-17 and PSR-18 implementation to be used
- How to get the latest tickets created by a customer? HOT 2
- webhook count support not available ? HOT 1
- Repository maintenance status HOT 14
- Problem with updates of users HOT 2
- tickets createMany method implementation HOT 2
- No method called iterator available in Zendesk\API\Resources\Core\Tickets HOT 2
- Testing Slack notification HOT 3
- Test Issue HOT 3
- Another test HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zendesk_api_client_php.