117
edits
Changes
no edit summary
==Common description==
Engine service API is intended first of all to provide third-party applications with ability to find out, if any Premium options for the engine, with which application works, are activated. Also API provides ability to activate desired option on behalf of the application.
API работаетworks по протоколуvia HTTP protocol. ЗапросыRequests are sent отсылаютсяto наthe адресaddress <tt><nowiki>http://localhost:6878/webui/api/service</nowiki></tt>
==Методы API methods==
Each request to API must have required parameter <tt>method</tt> that contains a name of the called method.
Below you can see a list of all available methods.
===check_user_key===
Check, if specified user key is downloaded to the engine.
parameters:
* '''user_key''' (''string'') - ключuser пользователяkey
response options:
* '''{"result": "ok", "error": null}''' - указанныйspecified ключkey загруженis вdownloaded движокto the engine
* '''{"result": "not_found", "error": null}''' - указанныйspecified ключkey неis загруженnot вdownloaded движокto the engine
* '''{"result": null, "error": "error description"}''' - приduring обработкеquery запросаprocessing возниклаerror ошибкаwas occurred
request example:
<nowiki>http://localhost:6878/webui/api/service?method=check_user_key&user_key=1179fcb364f83cc30150b3daffd55ae0a6b70fea</nowiki>
response:
<nowiki>{"result": "not_found", "error": null}</nowiki>
===check_product_user_keys===
Check availability of user keys for a specific product.
parameters:
* '''product_key''' (''string'') - публичнаяpublic частьpart ключаof продуктаthe product key
response options:
* '''{"result": "ok", "error": null}''' - вat движокleast загруженone какkey минимумfor одинa ключspecified дляapplication указанногоwas приложенияdownloaded to the engine
* '''{"result": "not_found", "error": null}''' - ключейthere дляare указанногоno приложенияkeys нетfor a specified application
* '''{"result": null, "error": "error description"}''' - приduring обработкеquery запросаprocessing возниклаerror ошибкаwas occurred
request example:
<nowiki>http://localhost:6878/webui/api/service?method=check_product_user_keys&product_key=1111</nowiki>
response:
<nowiki>{"result": "ok", "error": null}</nowiki>
===load_extension===
In body of the request you have to transfer contents of the extension string.
response options:
* '''{"result": true, "error": null}''' - [[extension string]]was успешноsuccessfully загруженаloaded вto движокthe engine
* '''{"result": null, "error": "error description"}''' - приduring обработкеquery запросаprocessing возниклаerror ошибкаwas occurred
request example:
<nowiki>http://localhost:6878/webui/api/service?method=load_extension</nowiki>
response:
<nowiki>{"result": true}</nowiki>
===get_services===
Get a list of premium options activated on the engine.
If parameter <tt>product_key</tt> is transferred, list of options available for all applications, as well as options available only for a specified application comes back.
If parameter <tt>product_key</tt> is not transferred, only list of options available for all applications comes back.
parameters:
* '''product_key''' (''string'') - необязательныйoptional параметр,parameter вthat которомtransfers передаетсяpublic публичнаяpart частьof ключаthe продуктаproduct key.
request example:
<nowiki>http://localhost:6878/webui/api/service?method=get_services&product_key=1111</nowiki>
Response format - an array of objects, each of which describes a single premium option.
example:
<nowiki>{
}</nowiki>
or
<nowiki>{"result": null, "error": "error description"}</nowiki>
Fields:
* '''id''' (''string'') - идентификаторoption опцииID
* '''name''' (''string'') - названиеoption опцииname
* '''valid_from''' (''integer'') - дата,date сof которойoption опция активнаactivation (unix timestamp)
* '''valid_to''' (''integer'') - дата,date поuntill которуюwhich опцияoption активнаis active (unix timestamp)
* '''trial''' (''boolean'') - true, еслиif опцияoption активированаwas бесплатноactivated наfor тестовыйfree периодfor a trial period
* '''description''' (''string'') - описаниеoption опцииdescription
===check_user_service===
Check whether the specified option is enabled on the engine.
parameters:
* '''id''' (''string'') - идентификаторoption опцииID
request example:
<nowiki>http://localhost:6878/webui/api/service?method=check_user_service&id=noAds</nowiki>
Example (option is not activated):
<nowiki>{
}</nowiki>
or
<nowiki>{"result": null, "error": "error description"}</nowiki>