PHP Class ApiMethods

Supported Version: PHP >= 5.0
See also: http://wiki.zanox.com/en/Web_Services
See also: http://apps.zanox.com
Author: Thomas Nicolai ([email protected])
Author: Lars Kirchhoff ([email protected])
Afficher le fichier Open project: fubralimited/php-oara

Méthodes publiques

Méthode Description
__construct ( string $protocol, string $version ) : void Constructor: Sets the api version and protocol
doRestfulRequest ( array $resource, $parameter = false, string $body = false ) : string Performs REST request.
doSoapRequest ( $service, string $method, array $params = [] ) : object Performs SOAP request.
enableCompression ( ) : void Set http protocol type
getProtocol ( ) : string Returns api protocol type
getVersion ( ) : string Sets the api version and protocol
serialize ( $rootName, $itemArray, $attr = [] ) : void Serializes item.
setConnectId ( string $connectId ) : void Set connectId
setHttpProtocol ( $httpProtocol ) : void Set http protocol type
setProtocol ( string $protocol ) : void Set api protocol type
setProxy ( string $host, integer $port, string $login, string $password ) : void Set http protocol type
setPublicKey ( $publicKey ) : void Set SecretKey
setRestfulAction ( $verb ) : void Sets the HTTP RESTful action verb.
setSecretKey ( string $secretKey ) : void Set SecretKey
setSecureApiCall ( $status = false ) : void Enables the API authentication.
setVersion ( string $version ) : void Sets the api version
unserialize ( string $string ) : void Unserializes item.

Private Methods

Méthode Description
getContentType ( ) : string Returns restful content type
getRestfulPath ( ) : string Returns restful api endpoint path
getWsdlUrl ( string $service ) : string Returns wsdl api endpoint
httpRequest ( string $uri, string $header, string $body = false ) : mixed HTTP REST Connection (GET/POST)
isValidHeader ( $responseHeader ) : string Returns if http response is valid.

Method Details

__construct() final public méthode

Constructor: Sets the api version and protocol
final public __construct ( string $protocol, string $version ) : void
$protocol string api protocol type
$version string api version
Résultat void

doRestfulRequest() public méthode

The function creates the RESTful request URL out of the given resource URI and the given REST interface. A REST URI for example to request a program with the id 49 looks like this: /programs/program/49
public doRestfulRequest ( array $resource, $parameter = false, string $body = false ) : string
$resource array RESTful resource e.g. /programs
$body string HTTP xml body message
Résultat string $result returns http response

doSoapRequest() public méthode

Performs SOAP request.
public doSoapRequest ( $service, string $method, array $params = [] ) : object
$method string soap service
$params array soap method parameter
Résultat object soap result object or false on error

enableCompression() final public méthode

Set http protocol type
final public enableCompression ( ) : void
Résultat void

getProtocol() final public méthode

Returns api protocol type
final public getProtocol ( ) : string
Résultat string api protocol type

getVersion() final public méthode

Sets the api version and protocol
final public getVersion ( ) : string
Résultat string api version

serialize() final public méthode

Transforms array into json or xml string while using the parser class. This is neccessary in order to update or create new items.
final public serialize ( $rootName, $itemArray, $attr = [] ) : void
Résultat void

setConnectId() final public méthode

Set connectId
final public setConnectId ( string $connectId ) : void
$connectId string zanox connectId
Résultat void

setHttpProtocol() final public méthode

Set http protocol type
final public setHttpProtocol ( $httpProtocol ) : void
Résultat void

setProtocol() final public méthode

Set api protocol type
final public setProtocol ( string $protocol ) : void
$protocol string api protocol type
Résultat void

setProxy() final public méthode

Set http protocol type
final public setProxy ( string $host, integer $port, string $login, string $password ) : void
$host string proxy host name
$port integer proxy port
$login string proxy login
$password string proxy password
Résultat void

setPublicKey() final public méthode

Set SecretKey
final public setPublicKey ( $publicKey ) : void
Résultat void

setRestfulAction() final public méthode

The given action might be GET, POST, PUT or DELETE. Be aware that no any action can be performed on any resource.
final public setRestfulAction ( $verb ) : void
Résultat void

setSecretKey() final public méthode

Set SecretKey
final public setSecretKey ( string $secretKey ) : void
$secretKey string zanox secret key
Résultat void

setSecureApiCall() final public méthode

Authentication is only required and therefore enabled for some privacy related functions like accessing your profile or reports.
final public setSecureApiCall ( $status = false ) : void
Résultat void

setVersion() final public méthode

Sets the api version
final public setVersion ( string $version ) : void
$version string api version
Résultat void

unserialize() final public méthode

Transforms json or xml string into array while using the parser class.
final public unserialize ( string $string ) : void
$string string xml or json string
Résultat void