Using https://github.com/zimbra-api/zimbra-api/
Successfully querying and getting data back using the api just don't know how use the data being passed back... can someone post an example of how I should be using data passed back from the response.fedloan irs.gov easybib
Zimbra PHP API!!
- rcardozo1987
- Posts: 23
- Joined: Tue Sep 10, 2019 9:14 pm
- ZCS/ZD Version: NETWORK edition, Patch 8.8.15_P11
Re: Zimbra PHP API!!
Jhonmicky, it seems you need some help with PHP... not Zimbra... right?Jhonmicky wrote:Using https://github.com/zimbra-api/zimbra-api/
Successfully querying and getting data back using the api just don't know how use the data being passed back... can someone post an example of how I should be using data passed back from the response.fedloan irs.gov easybib
- barrydegraaff
- Zimbra Employee
- Posts: 246
- Joined: Tue Jun 17, 2014 3:31 am
- Contact:
Re: Zimbra PHP API!!
After setting up the php soap as described in https://github.com/zimbra-api/zimbra-api/ it can be used like so:
Code: Select all
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// This file is generated by Composer
require_once 'zimbra-api/vendor/autoload.php';
$api = \Zimbra\Admin\AdminFactory::instance('https://zimbra.EXAMPLE.COM:7071/service/admin/soap');
$api->auth('soapapi', 'YOUR ADMIN PASSWORD HERE');
$account = new \Zimbra\Struct\AccountSelector(\Zimbra\Enum\AccountBy::NAME(), 'soapapi');
$accountInfo = $api->getAccountInfo($account);
print_r($accountInfo);
phpinfo();
--
Barry de Graaff
Email: barry.degraaff [at] synacor [dot] com
Admin of Zimbra-Community Github: https://github.com/orgs/Zimbra-Community/ and the
Zimlet Gallery https://gallery.zetalliance.org/extend/
Barry de Graaff
Email: barry.degraaff [at] synacor [dot] com
Admin of Zimbra-Community Github: https://github.com/orgs/Zimbra-Community/ and the
Zimlet Gallery https://gallery.zetalliance.org/extend/
Re: Zimbra PHP API!!
And what if I want to get messages by search request? I try to find messages by subject "Mail Delivery System" in inbox folder:
and get $req like
So how can I get response? Or my request is incorrect?
Code: Select all
$req = new \Zimbra\Mail\Request\Search();
$req->setQuery('Mail Delivery System in:inbox')
->setResultMode('IDS')
->setField('subject')
->setSearchTypes('message')
->setLimit(1000);
Code: Select all
Zimbra\Mail\Request\Search Object
(
[_requestName:Zimbra\Soap\Request:private] => SearchRequest
[_responseName:Zimbra\Soap\Request:private] => SearchResponse
[_properties:Zimbra\Struct\Base:private] => PhpCollection\Map Object
(
[elements:protected] => Array
(
[resultMode] => IDS
[field] => subject
[types] => message
[limit] => 1000
)
)
[_children:Zimbra\Struct\Base:private] => PhpCollection\Map Object
(
[elements:protected] => Array
(
[query] => Mail Delivery System in:inbox
)
)
[_value:Zimbra\Struct\Base:private] =>
[_xmlNamespace:Zimbra\Struct\Base:private] => urn:zimbraMail
[listeners:protected] => Array
(
[before] => Array
(
[0] => Closure Object
(
[this] => Zimbra\Mail\Request\Search Object
*RECURSION*
[parameter] => Array
(
[$sender] =>
)
)
)
)
[_headers:Zimbra\Mail\Request\Search:private] => Zimbra\Common\TypedSequence Object
(
[_type:Zimbra\Common\TypedSequence:private] => Zimbra\Struct\AttributeName
[elements:protected] => Array
(
)
)
)