Changes

Jump to: navigation, search

Reseller API

175 bytes removed, 16:07, 6 September 2017
no edit summary
==Общее описание Common description of API==Запросы This API отправляются методом HTTP-GET на такие адреса:* тестовый режим: <tt><nowiki>https://apiallows you to work with user keys in Ace Stream system.sandbox.acestream.net/reseller</nowiki></tt>* боевой режим: <tt><nowiki>https://api.acestreamAPI provides methods to create user keys and activate different options for the keys.net/reseller</nowiki></tt>
Ответы на запросы приходят в формате json==Requests format==API requests are sent via HTTP-GET method to the following addresses:* test mode: <tt><nowiki>https://api-sandbox.acestream.net/reseller</nowiki></tt>* work mode: <tt><nowiki>https://api.acestream.net/reseller</nowiki></tt>
Если при обработке запроса возникла ошибкаResponses for these requests comes in json format. If during query processing an error was occurred, будет отослан ответ такого видаthe following kind of response will be sent:
<tt><nowiki>{"error":"error descrtiption"}</nowiki></tt>
Ответы за успешно обработанные запросы зависят от вызываемого метода.Responses to successfully processed requests depend on a method being called
===Обязательные общие параметры для всех запросовRequired common parameters for all requests===* '''method''' - вызываемый метод called APImethod* '''api_key''' - ключ клиента APIclient key* '''api_version''' - поддерживаемая версия supported API version (текущая версияcurrent version: 1.0)* '''app''' - идентификатор маркетаmarket ID* '''sign''' - цифровая подпись запросаrequest's digital signature
===Алгоритм формирования цифровой подписиAlgorithm for generating a digital signature===* создается массив строк вида array of strings like "название_параметраparameter_name=значение_параметраparameter_value"is created* полученный массив сортируетсяthe resulting array is sorted* элементы отсортированного массива объединяются в строку с разделителем elements of the sorted array are combined in a string with a separator "#"* к полученной строке добавляется секретный ключ клиента private key of APIclient is added to the resulting string* подписью является signature is sha1-хеш от полученной строки hash of the resulting string (в шестнадцатеричном представленииin hexadecimal representation, 40 символовcharacters, маленькими буквамиlowercase)
Код на PHPcode:
<tt><nowiki>function makeSignature(array $params, $apiSecret)
{
}</nowiki></tt>
==Методы APImethods==
===getServiceCost===
Получить стоимость опцииGet the cost of a service
параметрыparameters:* '''service''' (''string'') - идентификатор опцииservice ID* '''period''' (''string'') - идентификатор периодаperiod ID
поля в ответеfields in response:* '''cost''' (''decimal'') - стоимость опции на указанный период в the cost of the service for a specified period in EUR
пример запросаrequest example: <nowiki>https://api.acestream.net/reseller?method=getServiceCost &crarr;
&api_version=1.0 &crarr;
&api_key=be6f66e0848528139583b567fb222215444fc8ac &crarr;
&sign=45c84ceffd3ec443586e8f4666b28abde8400768</nowiki>
ответresponse:
<nowiki>{"cost":1}</nowiki>
===activateService===
Активировать опцию для пользователяActivate service for user
параметры:* As a result of successful activation, funds will be charged from reseller'''user_key''' (''string'') - ключ пользователя* '''service''' (''string'') - идентификатор опции* '''period''' (''string'') - идентификатор периодаs balance.
поля в ответеparameters:* '''validFromuser_key''' (''unix timestampstring'') - с какого времени опция активнаuser key* '''validToservice''' (''unix timestampstring'') - до какого времени опция активнаservice ID* '''period''' (''string'') - period ID
пример запросаfields in response:* '''validFrom''' (''unix timestamp'') - from what time service is active* '''validTo''' (''unix timestamp'') - till what time service will be active request example: <nowiki>https://api.acestream.net/reseller?method=activateService &crarr;
&api_version=1.0 &crarr;
&api_key=be6f66e0848528139583b567fb222215444fc8ac &crarr;
&sign=c4df772a4a41ad7bbb4d7d07e46cad5e3622c59e</nowiki>
ответ response (успешная активация опцииsuccessful activation):
<nowiki>{"validFrom":1376048972,"validTo":1378640972}</nowiki>
ответ response (на балансе реселлера недостаточно средств для активации опцииthere are not enough funds on resellers balance to activate the service):
<nowiki>{"error":"not enough credits"}</nowiki>
===getUserKeyInfo===
Получить информацию о ключе пользователяGet information about user key
параметрыparameters:* '''user_key''' (''string'') - ключ пользователяuser key
поля в ответеfields in response:* '''services''' (''array'') - массив опцийarray of services, привязанных к данному ключу пользователяbound to this user key. Каждая опция описывается такими полямиEach service ia described with the following fields:** '''id''' (''string'') - идентификатор опцииservice ID** '''validFrom''' (''unix timestamp'') - с какого времени опция активнаfrom what time service is active** '''validTo''' (''unix timestamp'') - до какого времени опция активнаtill what time service will be active** '''enabled''' (''boolean'') - активна ли опция в данный моментis service active at this moment
пример запросаrequest example: <nowiki>https://api.acestream.net/reseller?method=getUserKeyInfo &crarr;
&api_version=1.0 &crarr;
&api_key=be6f66e0848528139583b567fb222215444fc8ac &crarr;
&sign=5e0fc46d908e5f224ce9fce9f6a83dd6b3502cc0</nowiki>
ответ response (нет опцийno services):
<tt>{"services":[]}</tt>
ответ response (есть опцииthere are services):
<nowiki>{"services": [
{"id": "noAds", "validFrom": 1374673235, "validTo": 1445089235, "enabled": true},
]}</nowiki>
==Идентификаторы опций==
* '''noAds''' - опция "No ADs" (отключение рекламы Ace Stream)
* '''premium''' - опция "Premium Streams" (доступ к премиум-контенту)
==Идентификаторы периодов=createUserKey===Create a new user key fields in response:* '''userKey''' (''string'') - created user key* '''extension''' (''string'') - content of extension file which is used for the following loading to the engine request example:  <nowiki>https://api.acestream.net/reseller?method=createUserKey &crarr; &api_key=cd3119af58cfa8833ba105a4fd4eb791395b921c &crarr; &api_version=1.0 &crarr; &app=3_250o55jdisu88skggogg4g4w4wc8wgskss4gkgkkk40k0gcsw8 &crarr; &sign=99982a11708ef4a80e12f1ca845d314340db8869</nowiki> response: <tt>{ "userKey": "c7456d962209ce22a8edd0c788940a15792bc575", "extension": "F5T6L+X\/TnhqoXP\/Tyzlad51LoGI3InF676iap &crarr; n6vuJUOLbFJNGfYQcakQMXAhSTrlc7XlmUydoGcnCXhw5qefoinHZHIL &crarr; VW51Pd5I0\/0YbKsmn\/Y78F1JhG1ckBExCtQTf\/NgLj+8TeTyPOfQS &crarr; lRub3k4G\/m0+Iqyq4hshKnmTIBlkDcytWZ5DyQFLetllUUz9rLFjvR8 &crarr; mF0qy3GCYtAw==" }</tt> ==Service ID==* '''noAds''' - service "No ADs" (disable Ace Stream ads)* '''premium''' - service "Premium Streams" (access to premium content)* '''premium1device''' - premium for one device* '''proxyServer''' - "Proxy Server" option (it allows using Ace Stream by third-party software products) ==Period ID==* '''m1''' - 30 днейdays* '''y1''' - 365 днейdays

Navigation menu