Zend Server API documentation

The official Zend Server API documentation

Installation

Via Composer

You can install the API with composer by adding the following lines to your composer.json file:

{
    "repositories": [
        {
            "type": "composer",
            "url": "http://packages.zendframework.com/"
        }
    ],
    "require": {
        "zendserverapi/zendserverapi": "dev-master"
    },
    "minimum-stability": "dev"
}
composer install

Run the installation and you’re ready to go.

Note

There are a few dependencies to the Zend Framework 2 from inside the library. The repositories section will allow you to install only the required components and not the whole framework. If you don’t register the Zend packagist repository, the whole Zend Framework 2 will be installed by composer. I recommend to register that repository to reduce the overhead during installation.

Configuration

This chapter explains the configuration possibilities of the Zend Server API ZendService.

Configuration File

The API is lookig for a configfile at vendor/zendserverapi/zendserverapi/config/config.php by default. This file is not included in the project, this will allow you to keep your project specific configuration on updates. You can find such a skeleton at vendor/zendserverapi/zendserverapi/config/config.dist.php:

<?php

return array(
    "servers" => array (
        # Contains a valid default config
        "general" => array(
            "version" => \ZendService\ZendServerAPI\Version::ZS56,
            "apiName" => "",
            "fullApiKey" => "",
            "readApiKey" => "",
            "host" => "localhost",
            "port" => "10081"
        )
    ),
    "settings" => array (
        'loglevel' => \Zend\Log\Logger::DEBUG
    )
);

You can change the location of the configuration file by 2 different ways. Either statically, or on the BaseAPI object level.

<?php
\ZendService\ZendServerAPI\PluginManager::setConfigFile(__DIR__.'/_files/config/config.php');
<?php
$server = new \ZendService\ZendServerAPI\Server();
$server->setConfig(__DIR__.'/_files/config/config.php');

The Server configuration

This configuration file allows you to add as many (and different) Zend Servers as you want.

The general section in the servers key is the default server. Every BaseAPI implementation (e.g. Monitor, Server, Administration, ...) receives a name with the first constructor parameter. If none parameter is provided, the general section will be used.

<?php

    return array(
        "servers" => array (
            # Contains a valid default config
            "general" => array(
                "version" => \ZendService\ZendServerAPI\Version::ZSCM56,
                "apiName" => "admin",
                "fullApiKey" => "bee698dde6a95de71932d65cb655c31fc4ea04c1fabaf6f0a1b852617eac32ac",
                "readApiKey" => "",
                "host" => "10.0.0.1",
                "port" => "10083",
                "protocol" => "https"
            ),
            "local" => array(
                "version" => \ZendService\ZendServerAPI\Version::ZS56,
                "apiName" => "admin",
                "readApiKey" => "9dc7f8c5ac43bb2ab36120861b4aeda8f9bb6c521e124360fd5821ef279fd9c7",
                "host" => "localhost",
                "port" => "10081"
            )
        ),
        "settings" => array (
            'loglevel' => \Zend\Log\Logger::DEBUG
        )
    );

This configuration will give you the possibility, to connect to a remote Zend Server 5.6 Cluster Manager on port 10083 via https that way:

<?php
$server = new \ZendService\ZendServerAPI\Server();
$server->getSystemInfo();

And to do the same locally this way:

<?php
$server = new \ZendService\ZendServerAPI\Server('local');
$server->getSystemInfo();

Note

If you use port 10082, https will be selected automatically. If you want to use http and port 10082, you’ve to set it explicit in the config. On every other port, http will be selected by default.

Configuration settings

The settings allow you to set a proxy and to change the loglevel that is used for every request. I suggest to use \Zend\Log\Logger::DEBUG for development and \Zend\Log\Logger::INFO for production (for auditing purposes). \Zend\Log\Logger::DEBUG will give you the plain HTTP requests and the responses. This is causing a huge amount of data per request. \Zend\Log\Logger::INFO will simply tell you, which request was performt on which server and when.

The proxy setting looks like this:

<?php

return array(
    "servers" => array (
        # Contains a valid default config
        "general" => array(
            "version" => \ZendService\ZendServerAPI\Version::ZS56,
                "apiName" => "",
                "fullApiKey" => "",
                "readApiKey" => "",
                "host" => "localhost",
                "port" => "10081"
        )
    ),
    "settings" => array (
        'loglevel' => \Zend\Log\Logger::DEBUG,
        'proxyHost' => 'http://internal.proxy',
        'proxyPort' => 8010
    )
);

Note

If you don’t specify a proxy port, 8080 will be used by default.

API Versioning

Configure the version

Reference: Zend Server 5.6 Webapi Versioning

The version needs to be specified in the Configuration File under the version key. The Web API was introduced in Zend Server 5.1 with the Web API Version 1.0. With Zend Server 5.5 the API Version 1.1 has been released. 1.2 came with Zend Server 5.6 and 1.3 with Zend Server 6. For now, the API is fully functional up to Zend Server 5.6 - Zend Server 6 implementation is in progress.

The following class constants are available:

<?php
namespace ZendService\ZendServerAPI;

class Version
{
    /**
     * Zend Server Cluster Manager 5.1
     * API Version 1.0
     * @var string
     */
    const ZSCM51 = "1.0";
    /**
     * Zend Server Cluster Manager 5.5
     * API Version 1.1
     * @var string
     */
    const ZSCM55 = "1.1";
    /**
     * Zend Server Cluster Manager 5.6
     * API Version 1.2
     * @var string
     */
    const ZSCM56 = "1.2";
    /**
     * Zend Server 5.1
     * API Version 1.0
     * @var string
     */
    const ZS51 = "1.0";
    /**
     * Zend Server 5.5
     * API Version 1.1
     * @var string
     */
    const ZS55 = "1.1";
    /**
     * Zend Server 5.6
     * API Version 1.2
     * @var string
     */
    const ZS56 = "1.2";
}

This is configured on the Server level and is the basis for the web api factories. Every API method is fetched from specific version factories. If you specifiy e.g. ZS55 on a Zend Server 5.6, you’re not able to perform Web API 1.2 actions! So take care, that you configure the correct API Version for your servers.

Web API Version methods

Web API 1.0

  • clusterGetServerStatus
  • clusterAddServer
  • clusterRemoveServer
  • clusterEnableServer
  • clusterDisableServer
  • restartPHP
  • The getSystemInfo Method
  • configurationImport
  • configurationExport

Web API 1.1

  • clusterReconfigureServer
  • applicationGetStatus
  • applicationDeploy
  • applicationRemove
  • applicationRollback
  • applicationSynchronize
  • applicationUpdate

Web API 1.2

  • codetracingDisable
  • codetracingEnable
  • codetracingIsEnabled
  • codetracingCreate
  • codetracingDelete
  • codetracingList
  • codetracingDownloadTraceFile
  • monitorGetRequestSummary
  • monitorGetIssuesListByPredefinedFilter
  • monitorGetIssuesDetails
  • monitorGetEventGroupDetails
  • monitorChangeIssueStatus
  • monitorExportIssueByEventsGroup
  • studioStartDebug
  • studioStartProfile

Server and Cluster Management methods

The following is a list and documentation of the available methods used to manage your server and/or cluster.

  • getSystemInfo
  • clusterGetServerStatus
  • clusterAddServer
  • clusterRemoveServer
  • clusterDisableServer
  • clusterEnableServer
  • clusterReconfigureServer
  • restartPHP

The getSystemInfo Method

Use this method to get information about the system, including the Zend Server edition and version, PHP version, licensing information, etc. This method produces similar output on all Zend Server systems, and is future compatible.

Method definition

<?php
public function getSystemInfo() { }

getSystemInfo information

Return value \ZendService\ZendServerAPI\DataTypes\SystemInfo (SystemInfo api doc)
Online reference getSystemInfo online reference
Available in Version
  • 1.0
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$systemInfo = $server->getSystemInfo();

The clusterGetServerStatus Method

Use this method to get the list of servers in the cluster and the status of each one. On a Zend Server Cluster Manager with no valid license, this operation fails. This operation causes Zend Server Cluster Manager to check the status of servers and return fresh, non-cached information. This is different from the Servers List tab in the GUI, which may present cached information. Users interested in reducing load by caching this information should do it in their own code.

Method definition

<?php
public function clusterGetServerStatus(array $parameters = array()) { }
Parameter
Parameter Data Type Default value Required Description
$parameter array array() no A list of server IDs. If specified, the status is returned for these servers only. If not specified, the status of all the servers is returned.

clusterGetServerStatus information

Return value \ZendService\ZendServerAPI\DataTypes\ServersList (ServersList api doc)
Online reference clusterGetServerStatus online reference
Available in Version
  • 1.0
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$serversList = $server->clusterGetServerStatus(array($serverId1, $serverId2));

foreach ($serversList as $server) {
    /** @var $server \ZendService\ZendServerAPI\DataTypes\ServersList */
    echo "Id: " . $server->getId() . PHP_EOL;
    echo "Name: " . $server->getName() . PHP_EOL;
 }

The clusterAddServer Method

Add a new server to the cluster. On a Zend Server Cluster Manager with no valid license, this operation fails.

Method clusterAddServer definition

<?php
public function clusterAddServer($serverName, $serverUrl, $guiPassword, $propagateSettings = false) { }
Parameter
Parameter Data Type Default value Required Description
$serverName string   yes The server name.
$serverUrl string   yes The server address as a full HTTP/HTTPS URL.
$guiPassword string   yes The server GUI password.
$propagateSettings boolean false no Propagate this server’s current settings to the rest of the cluster.

clusterAddServer information

Return value: \ZendService\ZendServerAPI\DataTypes\ServerInfo (ServerInfo api doc)
Online reference: clusterAddServer online reference
Available in Version:
  • 1.0
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$serverName = "server10";
$serverUrl = "https://10.0.0.10:10082/ZendServer";
$guiPassword = "test";
$propagateSettings = false;
$serverInfo = $server->clusterAddServer($serverName, $serverUrl, $guiPassword, $propagateSettings);

The clusterRemoveServer Method

This method removes a server from the cluster. The removal process may be asynchronous if Session Clustering is used. If this is the case, the initial operation will return an HTTP 202 response. As long as the server is not fully removed, further calls to remove the same server should be idempotent. On a Zend Server Cluster Manager with no valid license, this operation fails.

Method clusterRemoveServer definition

<?php
public function clusterRemoveServer($serverId, $force = false) { }
Parameter
Parameter Data Type Default value Required Description
$serverId int   yes The id of the server to remove
$force boolean false no Force-remove the server, skipping graceful shutdown process.

clusterRemoveServer information

Return value: \ZendService\ZendServerAPI\DataTypes\ServerInfo (ServerInfo api doc)
Online reference: clusterRemoveServer online reference
Available in Version:
  • 1.0
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$serversList = $server->clusterGetServerStatus();

// removes all server from the 'general' cluster
foreach ($serversList as $server) {
    $server->clusterRemoveServer($server->getId());
}

The clusterEnableServer Method

This method is used to re-enable a cluster member. This process may be asynchronous if Session Clustering is used. If this is the case, the initial operation will return an HTTP 202 response. This action is idempotent, and running it on an enabled server will result in a 200 OK response with no consequences. On a Zend Server Cluster Manager with no valid license this operation fails.

Method clusterEnableServer definition

<?php
public function clusterEnableServer($serverId)
Parameter
Parameter Data Type Default value Required Description
$serverId int   yes The server id

clusterEnableServer information

Return value: \ZendService\ZendServerAPI\DataTypes\ServerInfo (ServerInfo api doc)
Online reference: clusterEnableServer online reference
Available in Version:
  • 1.0
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$serversList = $server->clusterGetServerStatus();

// enables all server from the 'general' cluster
foreach ($serversList as $server) {
    $server->clusterEnableServer($server->getId());
}

The clusterDisableServer Method

This method disables a cluster member. This process may be asynchronous if Session Clustering is used. If this is the case, the initial operation returns an HTTP 202 response. As long as the server is not fully disabled, further calls to this method are idempotent. On a Zend Server Cluster Manager with no valid license, this operation fails.

Method clusterDisableServer definition

<?php
public function clusterDisableServer($serverId)
Parameter
Parameter Data Type Default value Required Description
$serverId int   yes The server id

clusterDisableServer information

Return value: \ZendService\ZendServerAPI\DataTypes\ServerInfo (ServerInfo api doc)
Online reference: clusterDisableServer online reference
Available in Version:
  • 1.0
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$serversList = $server->clusterGetServerStatus();

// disables all server from the 'general' cluster
foreach ($serversList as $server) {
    $server->clusterDisableServer($server->getId());
}

The clusterReconfigureServer Method

Re-configure a cluster member to match the cluster’s profile. This operation will fail on a Zend Server Cluster Manager with no valid license.

Method clusterReconfigureServer definition

<?php
public function clusterReconfigureServer($serverId, $doRestart = false)
Parameter
Parameter Data Type Default value Required Description
$serverId int   yes Specify if the re-configured server should be restarted after the re-configure action.
$doRestart boolean false no Sends the restart command to all servers at the same time

Note

Because of the Zend Deployment Deamon (zdd), since Zend Server 5.5, there is an implicit restart on this method anyways.

clusterReconfigureServer information

Return value: \ZendService\ZendServerAPI\DataTypes\ServerInfo (ServerInfo api doc)
Online reference: clusterReconfigureServer online reference
Available in Version:
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$serverInfo = $server->clusterGetServerStatus();

// reconfigure all server from the 'general' cluster
foreach ($serversList as $server) {
    $server->clusterReconfigureServer($server->getId());
}

The restartPhp Method

This method restarts PHP on all servers or on specified servers in the cluster. A 202 response in this case does not always indicate a successful restart of all servers. Use the clusterGetServerStatus command to check the server(s) status again after a few seconds.

Method restartPhp definition

<?php
public function restartPhp($serverIds = array(), $parallelRestart = false) { }
Parameter
Parameter Data Type Default value Required Description
$serverIds array array() no A list of server IDs to restart. If not specified, all servers in the cluster will be restarted. In a single Zend Server context this parameter is ignored.
$parallelRestart boolean false no Sends the restart command to all servers at the same time.

restartPhp information

Return value: \ZendService\ZendServerAPI\DataTypes\ServersList (ServersList api doc)
Online reference: restartPhp online reference
Available in Version:
  • 1.0
  • 1.1
  • 1.2
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Server;

$server = new Server();
$server->restartPhp();

Filter methods

Filter API actions provide external actors with ways to query and manipulate filters and their definitions.

  • filterGetByType
  • filterSave
  • filtersDelete

The filterGetByType Method

Retrieve and display a list of filters.

Method filterGetByType definition

<?php
public function filterGetByType($type) { }
Parameter
Parameter Data Type Default value Required Description
$type string   yes Type of a filter (issue,job)

filterGetByType information

Return value \ZendService\ZendServerAPI\DataTypes\Filters (Filters api doc)
Online reference filterGetByType online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Filter;

$server = new Filter();
$filters = $server->filterGetByType("issue");

foreach($filters as $filter) {
    echo $filter->getName() . PHP_EOL;
}

The filterSave Method

Save a filter.

Method filterSave definition

<?php
public function filterSave($type, $name, $id = null, $data = array()) { }
Parameter
Parameter Data Type Default value Required Description
$type string   yes Type of a filter (issue,job)
$name string   yes Name of filter.
$id int   no ID of a filter.
$data array array() no Array of parameters to be saved.

filterSave information

Return value \ZendService\ZendServerAPI\DataTypes\Filter (Filter api doc)
Online reference filterSave online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Filter;

$server = new Filter();
$filter = $server->filterSave("issue", "foo", array("eventTypes" => array("function-slow-exec")));

echo $filter->getName() . " successfully added with id " . $filter->getId() . PHP_EOL;

The filterDelete Method

Deletes a filter.

Method filterDelete definition

<?php
public function filterDelete($name) { }
Parameter
Parameter Data Type Default value Required Description
$name string   yes Name of filter.

filterDelete information

Return value \ZendService\ZendServerAPI\DataTypes\Filter (Filter api doc)
Online reference filterDelete online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Filter;

$server = new Filter();
$filter = $server->filterDelete("foo");

echo $filter->getName() . " successfully removed" . PHP_EOL;

Audit methods

Save settings of audit history and triggers.

  • auditGetList
  • auditGetDetails
  • auditSetSettings

The auditGetList Method

Get a list of audit entries.

Method auditGetList definition

<?php
public function auditGetList($limit = null, $offset = null, $order = null, $direction = null, $filters = array()) { }
Parameter
Parameter Data Type Default value Required Description
$limit int   no The number of rows to retrieve. Default lists all audit entries up to an arbitrary limit set by the system
$offset int 0 no A paging offset to begin the list from. Default: 0
$order string audit_id no Column identifier for sorting the result set (audit_id, node_id, time).
$direction string DESC no Sorting direction: ASC or DESC.
$filters array array() no Add filter parameters in an ad-hoc manner. These filters will be added to the predefined filter that was passed. This parameter is an array with a predefined set of parameters that accept strings or arrays to hold multiple values: from: string, a timestamp to use for retrieving audit rows to: string, a timestamp to use for retrieving audit rows freeText: string auditTypes: array, a list of auditTypes- AUDIT_APPLICATION_DEPLOY, AUDIT_APPLICATION_REMOVE, AUDIT_APPLICATION_UPGRADE, AUDIT_APPLICATION_ROLLBACK, AUDIT_APPLICATION_REDEPLOY, AUDIT_APPLICATION_REDEPLOY_ALL, AUDIT_APPLICATION_DEFINE, AUDIT_DIRECTIVES_MODIFIED, AUDIT_EXTENSION_ENABLED, AUDIT_EXTENSION_DISABLED, AUDIT_RESTART_DAEMON, AUDIT_RESTART_PHP, AUDIT_GUI_AUTHENTICATION, AUDIT_GUI_CHANGE_PASSWORD, AUDIT_GUI_AUTHORIZATION, AUDIT_GUI_AUTHENTICATION_LOGOUT, AUDIT_GUI_AUDIT_SETTINGS_SAVE, AUDIT_GUI_BOOTSTRAP_CREATEDB, AUDIT_GUI_BOOTSTRAP_SAVELICENSE, AUDIT_SERVER_JOIN, AUDIT_SERVER_ADD, AUDIT_SERVER_ENABLE, AUDIT_SERVER_DISABLE, AUDIT_SERVER_REMOVE, AUDIT_SERVER_REMOVE_FORCE, AUDIT_SERVER_RENAME, AUDIT_SERVER_SETPASSWORD, AUDIT_CODETRACING_CREATE, AUDIT_CODETRACING_DELETE, AUDIT_CODETRACING_DEVELOPER_ENABLE, AUDIT_CODETRACING_DEVELOPER_DISABLE, AUDIT_JOBQUEUE_REQUEUE, AUDIT_JOBQUEUE_DELETE, AUDIT_MONITOR_RULES_ENABLE, AUDIT_MONITOR_RULES_DISABLE, AUDIT_MONITOR_RULES_SAVE, AUDIT_MONITOR_RULES_REMOVE, AUDIT_STUDIO_DEBUG, AUDIT_STUDIO_PROFILE, AUDIT_STUDIO_SOURCE, AUDIT_CLEAR_OPTIMIZER_PLUS_CACHE, AUDIT_CLEAR_DATA_CACHE_CACHE, AUDIT_CLEAR_PAGE_CACHE_CACHE, AUDIT_PAGE_CACHE_SAVE_RULE, AUDIT_PAGE_CACHE_DELETE_RULES, AUDIT_JOB_QUEUE_SAVE_RULE, AUDIT_JOB_QUEUE_DELETE_RULES, AUDIT_JOB_QUEUE_DELETE_JOBS, AUDIT_JOB_QUEUE_REQUEUE_JOBS, AUDIT_JOB_QUEUE_RESUME_RULES,AUDIT_JOB_QUEUE_DISABLE_RULES, AUDIT_JOB_QUEUE_RUN_NOW_RULE

auditGetList information

Return value \ZendService\ZendServerAPI\DataTypes\AuditMessages (AuditMessages api doc)
Online reference auditGetList online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Audit;

$audit = new Audit();
$auditMesssages = $audit->auditGetList();

foreach($auditMessages as $auditMessage) {
    echo $auditMessage->getAuditTypeTranslated() . " by " . $auditMessage->getUsername() . PHP_EOL;
}

The auditGetDetails Method

Get all details available on a particular audit item.

Method auditGetDetails definition

<?php
public function auditGetDetails($auditId) { }
Parameter
Parameter Data Type Default value Required Description
$auditId int   yes Audit ID to get all details for

auditGetDetails information

Return value \ZendService\ZendServerAPI\DataTypes\AuditMessageDetails (AuditMessageDetails api doc)
Online reference auditGetDetails online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Audit;

$audit = new Audit();
$auditMesssages = $audit->auditGetList();

foreach($auditMessages as $auditMessage) {
    $details = $audit->auditGetDetails($auditMessage->getId());
    echo $details->getAuditProgress()->getServerName() . PHP_EOL
}

The auditSetSettings Method

Get all details available on a particular audit item.

Method auditSetSettings definition

<?php
public function auditSetSettings($history, $email = null, $callbackUrl = null) { }
Parameter
Parameter Data Type Default value Required Description
$history int   yes Number of saved days in history
$email string   no Email to send notifications to
$callbackUrl string   no URL to send notification to

auditSetSettings information

Return value \ZendService\ZendServerAPI\DataTypes\AuditSettings (AuditSettings api doc)
Online reference auditSetSettings online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Audit;

$audit = new Audit();
$audit->auditSetSettings(20, "a@b.com", "http://www.test.com");

Administration methods

The following is a list of methods available for the Administration feature:

  • userAuthenticateSettings
  • userSetPassword
  • setPassword
  • apiKeysGetList
  • apiKeysAddKey
  • apiKeyRemove
  • serverValidateLicense
  • aclSetGroups
  • bootstrapSingleServer

The userAuthenticateSettings Method

Modify current authentication settings, allowing the user to switch between simple and extended authentication and authorization schemes.

Method userAuthenticateSettings definition

<?php
public function userAuthenticateSettings($type, $password, $confirmNewPassword, $ldap = array()) { }
Parameter
Parameter Data Type Default value Required Description
$type string   yes One of : simple, extended
$password string   yes Current user’s password for authentication
$confirmNewPassword string   yes Confirmation of new password
$ldap array   no

Array of ldap properties: host: host, ip or location of the active directory

port: port part of the URL above

encryption:

ssl: use SSL to secure communications

tls: start TLS to secure communications

none: no encryption is used

username: directory username, broken to CN and DC parts for use in querying the active directory

password: matching password for the above username

baseDn: DN broken down to CN and DC parts for using during user authentication

userAuthenticateSettings information

Return value \ZendService\ZendServerAPI\DataTypes\AuthenticationType (AuthenticationType api doc)
Online reference userAuthenticateSettings online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$administration->userAuthenticateSettings("extended", "currentPassword", "newPassword",
    array(
        "host" => "internalldap",
        "port" => 636,
        "encryption" => "ssl",
        "username" => "admin",
        "password" => "currentPassword",
        "baseDn" => "internal"
    )
);

The userSetPassword Method

Modify a specific user password. This action changes any user password and is an administrative action. Note that a separate action exists for the user to modify his own password and has a lower permission level.

Method userSetPassword definition

<?php
public function userSetPassword($username, $password, $newPassword, $confirmNewPassword) { }
Parameter
Parameter Data Type Default value Required Description
$username string   yes

admin (for Administrator)

testuser (for Developer)

$password string   yes Current password
$newPassword string   yes New password
$confirmNewPassword string   yes Confirmation of new password

userSetPassword information

Return value \ZendService\ZendServerAPI\DataTypes\UserInfo (UserInfo api doc)
Online reference userSetPassword online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$administration->userSetPassword("admin", "oldpassword", "newpassword", "newpassword");

The setPassword Method

Modify a current user password.

Method setPassword definition

<?php
public function setPassword($password, $newPassword, $confirmNewPassword) { }
Parameter
Parameter Data Type Default value Required Description
$password string   yes Current password
$newPassword string   yes New password
$confirmNewPassword string   yes Confirmation of new password

setPassword information

Return value \ZendService\ZendServerAPI\DataTypes\UserInfo (UserInfo api doc)
Online reference setPassword online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$administration->setPassword("oldpassword", "newpassword", "newpassword");

The ApiKeysGetList Method

Get a list of api keys.

Method apiKeysGetList definition

<?php
public function apiKeysGetList() { }

apiKeysGetList information

Return value \ZendService\ZendServerAPI\DataTypes\UserInfo (ApiKeys api doc)
Online reference apiKeysGetList online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$apiKeys = $administration->apiKeysGetList();

The apiKeysAddKey Method

Add a WebAPI Key.

Method apiKeysAddKey definition

<?php
public function apiKeysAddKey($name, $username) { }
Parameter
Parameter Data Type Default value Required Description
$name string   yes The name of the key
$username string   yes Any username supplied for retrieving ACL information

apiKeysAddKey information

Return value \ZendService\ZendServerAPI\DataTypes\ApiKeys (ApiKeys api doc)
Online reference apiKeysAddKey online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$apiKeys = $administration->apiKeysAddKey("foo", "admin");

The apiKeysRemoveKey Method

Remove a WebAPI Key.

Method apiKeysRemoveKey definition

<?php
public function apiKeysRemoveKey($ids) { }
Parameter
Parameter Data Type Default value Required Description
$ids array   yes array of api key ids to remove

apiKeysRemoveKey information

Return value \ZendService\ZendServerAPI\DataTypes\ApiKeys (ApiKeys api doc)
Online reference apiKeysRemoveKey online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$apiKeys = $administration->apiKeysRemoveKey(array(5, 6, 7));

The serverValidateLicense Method

Validate a Zend Server license.

Method serverValidateLicense definition

<?php
public function serverValidateLicense($licenseName, $licenseValue) { }
Parameter
Parameter Data Type Default value Required Description
$licenseName string   yes The name of the license
$licenseValue string   yes The value of the license

serverValidateLicense information

Return value \ZendService\ZendServerAPI\DataTypes\LicenseValidated (LicenseValidated api doc)
Online reference serverValidateLicense online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$licenseValidated = $administration->serverValidateLicense("TRIAL-1795-69", "V1Q26G1VUK185031C5ACF7165686C91B");

The serverStoreLicense Method

Stores a Zend Server license.

Method serverStoreLicense definition

<?php
public function serverStoreLicense($licenseName, $licenseValue) { }
Parameter
Parameter Data Type Default value Required Description
$licenseName string   yes The name of the license
$licenseValue string   yes The value of the license

serverStoreLicense information

Return value \ZendService\ZendServerAPI\DataTypes\LicenseValidated (LicenseValidated api doc)
Online reference serverValidateLicense online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$licenseValidated = $administration->serverStoreLicense("TRIAL-1795-69", "V1Q26G1VUK185031C5ACF7165686C91B");

The aclSetGroups Method

Store a set of group mappings for resolving user roles during authentication. These groups correspond to roles within the system or to applications that implicitly grant the developerLimited role to the user.

Method aclSetGroups definition

<?php
public function aclSetGroups($roleGroups, $appGroups = null) { }
Parameter
Parameter Data Type Default value Required Description
$roleGroups array   yes An associative list of role names and their corresponding group.
$appGroups array   no An associative list of application IDs (numbers) and their corresponding group.

aclSetGroups information

Return value \ZendService\ZendServerAPI\DataTypes\LicenseValidated (LicenseValidated api doc)
Online reference aclSetGroups online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$roleGroups = $administration->->aclSetGroups(array("developer" => "bar"));

The bootstrapSingleServer Method

Bootstrap a server for standalone usage in production or development environment. This action is designed to give an automated process the option to bootstrap a server with particular settings. Note that once a server has been bootstrapped, it may not be added passively into a cluster using clusterAddServer. It may still join a cluster using a direct WebAPI -serverAddToCluster, or a UI call. This WebAPI action is explicitly accessible without a WebAPI Key, but only during the bootstrap stage. Unlike the UI bootstrap/launching process, this bootstrap action does not restart Zend Server nor perform any authentication. A WebAPI key with administrative permissions is created as part of the bootstrap process so that you may immediately continue working. It is up to the user to decide what to do with this key once the bootstrap is completed. Read a certain number of log lines from the end of the file log. If serverId is passed, then the request will be performed against that cluster member, otherwise it is performed locally.

Method bootstrapSingleServer definition

<?php
public function bootstrapSingleServer(
        $adminPassword,
        $orderNumber,
        $licenseKey,
        $acceptEula,
        $production = null,
        $applicationUrl = null,
        $adminEmail = null,
        $developerPassword = null
    ) { }
Parameter
Parameter Data Type Default value Required Description
$adminPassword string   yes The new administrator password to store for authentication
$orderNumber string   yes License order number to store in the server’s configuration. This license can be obtained from zend.com
$licenseKey string   yes License key to store in the server’s configuration. This license can be obtained from zend.com
$acceptEula bool   yes Must be set to true to accept ZS6’s EULA
$production bool   no Bootstrap this server using the factory “production” usage profile. Default value: true
$applicationUrl string   no The default application URL to use when displaying and handling deployed application URLs in the UI. Default: empty
$adminEmail string   no The default Email to use when sending notifications about events, audit entries and other features
$developerPassword string   no The new developer user password to be stored for authentication. If no password is supplied, the developer user will not be created

bootstrapSingleServer information

Return value \ZendService\ZendServerAPI\DataTypes\Bootstrap (Bootstrap api doc)
Online reference bootstrapSingleServer online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Administration;

$administration = new Administration();
$bootstrap = $administration->bootstrapSingleServer("test", "ON", "LC", true);

Jobqueue methods

Job Queue API actions provide external actors with ways to query and manipulate jobs and their recurring definitions. The following is a list of methods available for the Job Queue feature:

<ul> <li>The jobqueueListJobs Method</li> <li>The jobqueueJobInfo Method</li> <li>The jobqueueDeleteJob Method</li> <li>The jobqueueRequeueJob Method</li> <li>The jobqueueListRules Method</li> <li>The jobqueueRuleInfo Method</li> <li>The jobqueueSaveRule Method</li> <li>The jobqueueDisableRules Method </li> <li>The jobqueueResumeRules Method </li> <li>The jobqueueDeleteRules Method</li> <li>The jobqueueRunNowRule Method</li> </ul>

The jobqueueJobsList Method

Job Queue API actions provide external actors with ways to query and manipulate jobs and their recurring definitions.

Method jobqueueJobsList definition

<?php
public function jobqueueJobsList($limit = null, $offset = null, $orderBy = null, $direction = null, $filter = null) { }
Parameter
Parameter Data Type Default value Required Description
$limit int   no Row limit to retrieve, defaults to value defined in zend-user-user.ini
$offset int 0 no The page offset to be displayed, defaults to 0
$orderBy string Date no Column to sort the result by (), defaults to Date
$direction string DESC no Sorting direction: ASC or DESC.
$filters array array() no Associative array, accteps any of the following keys: app_id, name, script, priority, status, rule_id, scheduled_before, scheduled_after, executed_before, executed_after, freeText The priority key, accepts the following values: low, normal, high, urgent. The status key, accepts the following values: Active, Waiting, Running, Completed, Failed, Timeout, Removed, Scheduled, Suspende

jobqueueJobsList information

Return value \ZendService\ZendServerAPI\DataTypes\Jobs (Jobs api doc)
Online reference jobqueueJobsList online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$jobs = $jobqueue->jobqueueJobsList();

The jobqueueJobInfo Method

Retrieve and display details of a job.

Method jobqueueJobInfo definition

<?php
public function jobqueueJobInfo($id) { }
Parameter
Parameter Data Type Default value Required Description
$id int   yes job id

jobqueueJobInfo information

Return value \ZendService\ZendServerAPI\DataTypes\JobInfo (JobInfo api doc)
Online reference jobqueueJobInfo online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$jobInfo = $jobqueue->jobqueueJobInfo(1);

The jobqueueDeleteJobs Method

Delete job queue.

Method jobqueueDeleteJobs definition

<?php
public function jobqueueDeleteJobs(array $ids) { }
Parameter
Parameter Data Type Default value Required Description
$ids array   yes job ids

jobqueueDeleteJobs information

Return value \ZendService\ZendServerAPI\DataTypes\Jobs (Jobs api doc)
Online reference jobqueueDeleteJobs online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$jobs = $jobqueue->jobqueueDeleteJobs(array(1));

The jobqueueRequeueJobs Method

Requeue a job.

Method jobqueueRequeueJobs definition

<?php
public function jobqueueRequeueJobs(array $ids) { }
Parameter
Parameter Data Type Default value Required Description
$ids array   yes job ids

jobqueueRequeueJobs information

Return value \ZendService\ZendServerAPI\DataTypes\Jobs (Jobs api doc)
Online reference jobqueueRequeueJobs online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$jobs = $jobqueue->jobqueueRequeueJobs(array(1));

The jobqueueListRules Method

Retrieve and display a list of jobs rules.

Method jobqueueListRules definition

<?php
public function jobqueueListRules($limit = null, $offset = null, $orderBy = null, $direction = null) { }
Parameter
Parameter Data Type Default value Required Description
$limit int   no Row limit to retrieve, defaults to value defined in zend-user-user.ini
$offset int 0 no The page offset to be displayed, defaults to 0
$orderBy string Date no Column to sort the result by (), defaults to Date
$direction string DESC no Sorting direction: ASC or DESC.

jobqueueListRules information

Return value \ZendService\ZendServerAPI\DataTypes\Jobs (Rules api doc)
Online reference jobqueueListRules online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$rules = $jobqueue->jobqueueListRules();

The jobqueueRuleInfo Method

Retrieve and display a job rule information.

Method jobqueueRuleInfo definition

<?php
public function jobqueueRuleInfo($id) { }
Parameter
Parameter Data Type Default value Required Description
$id int   yes job id

jobqueueRuleInfo information

Return value \ZendService\ZendServerAPI\DataTypes\RuleInfo (RuleInfo api doc)
Online reference jobqueueRuleInfo online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$ruleInfo = $jobqueue->jobqueueRuleInfo(1);

The jobqueueSaveRule Method

Create a job queue rule.

Method jobqueueSaveRule definition

<?php
public function jobqueueSaveRule($url, $options, $vars = array()) { }
Parameter
Parameter Data Type Default value Required Description
$url string   yes A URL for the job.
$options string   yes Rule options. (schedule pattern)
$vars array   no Variables for the rule.

jobqueueSaveRule information

Return value \ZendService\ZendServerAPI\DataTypes\RuleInfo (RuleInfo api doc)
Online reference jobqueueSaveRule online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$ruleInfo = $jobqueue->jobqueueSaveRule("http://www.example.com/foo", "1 */10");

The jobqueueDisableRules Method

Suspend a job queue rule.

Method jobqueueDisableRules definition

<?php
public function jobqueueDisableRules(array $ruleIds) { }
Parameter
Parameter Data Type Default value Required Description
$ruleIds array   yes Array of rule ids

jobqueueDisableRules information

Return value \ZendService\ZendServerAPI\DataTypes\Rules (Rules api doc)
Online reference jobqueueDisableRules online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$rules = $jobqueue->jobqueueDisableRules(array(1));

The jobqueueResumeRules Method

Resume a suspended job queue rule.

Method jobqueueResumeRules definition

<?php
public function jobqueueResumeRules(array $ruleIds) { }
Parameter
Parameter Data Type Default value Required Description
$ruleIds array   yes Array of rule ids

jobqueueResumeRules information

Return value \ZendService\ZendServerAPI\DataTypes\Rules (Rules api doc)
Online reference jobqueueResumeRules online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$rules = $jobqueue->jobqueueResumeRules(array(1));

The jobqueueDeleteRules Method

Delete a job queue rule.

Method jobqueueDeleteRules definition

<?php
public function jobqueueDeleteRules(array $ruleIds) { }
Parameter
Parameter Data Type Default value Required Description
$ruleIds array   yes Array of rule ids

jobqueueDeleteRules information

Return value \ZendService\ZendServerAPI\DataTypes\Rules (Rules api doc)
Online reference jobqueueDeleteRules online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$rules = $jobqueue->jobqueueDeleteRules(array(1));

The jobqueueRunNowRule Method

Run a scheduled job that was scheduled for a later time.

Method jobqueueRunNowRule definition

<?php
public function jobqueueRunNowRule($ruleId) { }
Parameter
Parameter Data Type Default value Required Description
$ruleId int   yes Rule id

jobqueueRunNowRule information

Return value \ZendService\ZendServerAPI\DataTypes\RuleInfo (RuleInfo api doc)
Online reference jobqueueRunNowRule online reference
Available in Version
  • 1.3

Example

<?php
use ZendService\ZendServerAPI\Jobqueue;

$jobqueue = new Jobqueue();
$ruleInfo = $jobqueue->jobqueueRunNowRule(1);

Search Page