Changes

Jump to: navigation, search

Engine Service API

822 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>-интерфейс движка, который работает на порту 6878-http-port</tt>.
Запросы отсылаются методами API works via HTTP GET либо POST, ответы в формате JSONprotocol.Requests are sent to the address <tt><nowiki>http://localhost:6878/webui/api/service</nowiki></tt>
ФайлResponds are in JSON format, as JSON-расширение можно получить с помощью API реселлера:http://wikiRPC, but without id.acestream.org/wiki/index.php/Reseller_API
Добавили на вики описание метода ==API для создания ключа пользователя:http://wiki.acestream.org/wiki/index.php/Reseller_API#createUserKeymethods==
Each request to API must have required parameter <tt>method</tt> that contains a name of the called method.
Метод API createUserkey позволяет создавать ключи двух разных типовBelow you can see a list of all available methods. Тип ключа задается параметром type:
'''<tt> type=1 </tt>''' - общий ключ, который обеспечит пользователю получения необходимого Премиум-статуса==check_user_key===Check, для работы с любыми приложениями и отключение определенных форматов рекламы (такой ключ работает на любых устройствах с любыми приложениями)if specified user key is downloaded to the engine.
parameters:* '''<tt> type=2 </tt>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
При создании ключа с типом 2 в запросе обязательно должен быть указан параметр request example: <ttnowiki> product http://localhost:6878/webui/api/service?method=check_user_key&user_key=1179fcb364f83cc30150b3daffd55ae0a6b70fea</ttnowiki> (идентификатор продукта, к которому должен быть привязан ключ).
Идентификатор продукта можно будет узнать на сайте acccounts.acestream.net (пока этот раздел недоступен мы можем выдавать идентификаторы по запросу).response: <nowiki>{"result": "not_found", "error": null}</nowiki>
Чтобы стать реселлером, нужно зарегистрироваться у нас на сайте и зайти по ссылке:===check_product_user_keys===https://accountsCheck availability of user keys for a specific product.acestream.net/reseller
Откроется форма регистрации реселлера, нужно нажать "зарегистрироваться", после этого мы получим письмо про регистрацию нового реселлера и поставим ему статус "подтвержден". После этого по ссылке httpsparameters://accounts.acestream.net/reseller будут доступны все инструменты для реселлера.* '''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
'''Предлагается следующая схема работы''' (п.2 - работает для версии движка 2.2.1-Next и 3.0.0 Beta)request example: <nowiki>http://localhost:6878/webui/api/service?method=check_product_user_keys&product_key=1111</nowiki>
'''1) Проверка ключа пользователяresponse:'''http <nowiki>{"result"://127.0.0.1"ok", "error":6878/webui/appnull}</check-user-key?key=<user_keynowiki>
Варианты ответов:===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: {"status"//localhost: "ok"}6878/webui/api/service?method=load_extension</nowiki>
* если указанный ключ не загружен в движок: {"status": "not_found"}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>
'''2) Чтобы загрузить файл расширения в движок, нужно отправить POST запрос на этот адресresponse:'''http <nowiki>{"result":true}<//127.0.0.1:6878/webui/app/load-extensionnowiki>
В теле запроса нужно передать содержимое файла расщирения===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.
- если расширение успешно загружен в движок: {"status": "ok"}If parameter <tt>product_key</tt> is not transferred, only list of options available for all applications comes back.
- если при обработке запроса возникла ошибкаparameters: {"error": "error description"}* '''product_key''' (''string'') - optional parameter that transfers public part of the product key.
'''3) Получение списка премиум-опций, активированных на движкеrequest example:''' <nowiki>http://127.0.0.1localhost:6878/webui/appapi/servicesservice?method=get_services&product_key=1111</getnowiki>
Формат ответа Response format - массив объектовan array of objects, каждый из которых описывает одну премиум-опциюeach of which describes a single premium option.example:
Пример <nowiki>{"result" [
{
"id": "noAds", "name": "No ADs",
"valid_from": 1376939146,
"valid_to": 1411671946,
"trial": false,
"description": "\u041e\u0442\u043a\u043b\
u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u043b\u0430\u043c\u044b Ace Stream"
}
],"error": null}</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> Response format - boolean value.Example (option is not activated):  ]<nowiki>{"result": false,"error": null}</nowiki>
'''Поля:'''or
* ''' <ttnowiki> id (string) </tt>''' - идентификатор опции* '''<tt> name (string) </tt>''' - название опции* '''<tt> valid_from (integer) </tt>''' - дата{"result": null, с которой опция активна (unix timestamp)* '''<tt> valid_to (integer) </tt>''' - дата, по которую опция активна (unix timestamp)* '''<tt> trial (boolean) </tt>''' - true, если опция активирована бесплатно на тестовый период* '''<tt> "error": "error description (string) "}</ttnowiki>''' - описание опции

Navigation menu