PHP Класс APIRest, glpi

Наследование: extends API
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$debug
$format
$parameters
$request_uri
$url_elements
$verb

Открытые методы

Метод Описание
call ( ) : json parse url and http body to retrieve : - HTTP VERB (GET/POST/DELETE/PUT) - Resource : Rest endpoint - Identifier - and parameters
getTypeName ( $nb )
inlineDocumentation ( $file = "apirest.md" ) Display the APIRest Documentation in Html (parsed from markdown)
parseIncomingParams ( boolean $is_inline_doc = false ) Construct this->parameters from query string and http body
returnResponse ( $response, $httpcode = 200, $aditionnalheaders = [] ) Generic function to send a message and an http code to client

Приватные методы

Метод Описание
getId ( ) : integer Retrieve in url_element the current id. If we have a multiple id (ex /Ticket/1/TicketFollwup/2), it always find the second
getItemtype ( $index, $recursive = true, $all_assets = false ) : boolean Retrieve and check itemtype from $this->url_elements

Описание методов

call() публичный Метод

And send to method corresponding identified resource
public call ( ) : json
Результат json with response or error

getTypeName() публичный статический Метод

См. также: CommonGLPI::GetTypeName()
public static getTypeName ( $nb )

inlineDocumentation() публичный Метод

Display the APIRest Documentation in Html (parsed from markdown)
public inlineDocumentation ( $file = "apirest.md" )
$file string relative path of documentation file (default 'apirest.md')

parseIncomingParams() публичный Метод

Construct this->parameters from query string and http body
public parseIncomingParams ( boolean $is_inline_doc = false )
$is_inline_doc boolean Is the current request asks to display inline documentation ? This will remove the default behavior who set content-type to application/json

returnResponse() публичный Метод

Generic function to send a message and an http code to client
public returnResponse ( $response, $httpcode = 200, $aditionnalheaders = [] )
$response string message or array of data to send
$httpcode integer http code (default 200) (see: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
$aditionnalheaders array headers to send with http response (must be an array(key => value))

Описание свойств

$debug защищенное свойство

protected $debug

$format защищенное свойство

protected $format

$parameters защищенное свойство

protected $parameters

$request_uri защищенное свойство

protected $request_uri

$url_elements защищенное свойство

protected $url_elements

$verb защищенное свойство

protected $verb