Changes

Jump to: navigation, search

Engine Service API

1,324 bytes removed, 16:33, 6 September 2017
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.
Сервисное Engine service API движка работает на порту works at port 6878, если не указан другой порт опцией if any other port is not specified with option <tt>--http-port</tt>.
API работает по протоколу works via HTTPprotocol. Запросы отсылаются на адрес Requests are sent to the address <tt><nowiki>http://localhost:6878/webui/api/service</nowiki></tt>
Ответы в формате Responds are in JSONformat, в виде as JSON-RPC, но без but without id.
==Методы APImethods==
Каждый запрос к 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:* '''keyuser_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=1111-2222-3333-44441179fcb364f83cc30150b3daffd55ae0a6b70fea</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===
Загрузка файла-расширения в движокLoading extension [[extension string]] into the app engine
Чтобы загрузить файл расширения в движок, нужно отправить To load extension string to the engine you have to send POST запрос на адрес request to the address <nowiki>http://localhost:6878/webui/api/service?method=load_extension</nowiki>
В теле запроса нужно передать содержимое файла расширения, полученное с помощью метода API для реселлеров [[Reseller_API#createUserKey|createUserKey]]In body of the request you have to transfer contents of the extension string.
варианты ответовresponse options:* '''{"result": true, "error": null}''' - расширение успешно загружено в движокextension 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>{
“status”: “ok”,“services”"result":
[
{
u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u043b\u0430\u043c\u044b Ace Stream"
}
],"error": null
}</nowiki>
или or
<nowiki>{“status”"result": “error”null, “error”"error": “error description”"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> Response format - boolean value.Example (option is not activated):  <nowiki>{"result": false,"error": null}</nowiki> or  <nowiki>{"result": null, "error": "error description"}</nowiki>

Navigation menu