Changes

Jump to: navigation, search

Resellers

64 bytes removed, 13:42, 6 September 2017
no edit summary
==ТерминыTerms==* '''ПартнерReseller''' - пользователь – Ace Stream user who has got rights to sell paid Ace Stream, который подтвердил свое согласие с условиями "Партнерского соглашения"options* '''Клиент APIUser key''' - партнер, который имеет доступ к API* '''Ключ пользователя''Ace Stream user' - идентификатор пользователяs ID* '''УслугаOption''' - дополнительная услугаadditional service / software service of Ace Stream, которая может быть активирована для конкретного ключа пользователяwhich can be activated for a specific user key * '''РеселлерApp''' - партнер, который продает услуги пользователям* reseller'''Приложение''' - продукт s product (как правилоsite, сайтmobile or desktop application) реселлера, через который осуществляется продажа услугwhich is used to sell options
==Что такое ключ пользователяHow to become a reseller==Ключ пользователя используется для идентификации пользователя в статистике* log in to site https://accounts.acestream.net using your login (if you do not have the login, запросах API и тyou have to [https://accounts.acestream.net/register register])* choose section [https://accounts.пacestream.net/partnership "Partnership"] in a top menu* click button "Become a reseller"
Пользователю автоматически присвается новый ключ при регистрации на сайте Ace Stream==API for Resellers==API for resellers allows you to activate different additional options for users of your apps.
Реселлер может получить ключ пользователя с помощью протокола OAuth2.A common scheme of work of API for resellers looks like this:* to activate a required option for a user your app (site, mobile or desktop app) sends a request to Ace Stream server, in which specifies user's id, option and activation period* the cost of specified option for the specified period is charged from your balance in Ace Stream system* specified option is activated for the user whose id you specified in the request
==Что такое Full description of API для реселлеров==API для реселлеров позволяет в автоматическом режиме активировать пользователям Ace Stream дополнительный услугиfor resellers you can find [[Reseller_API/en|here]].
На данный момент To work with API предоставляет такие функцииyou will need the following two identifiers:* узнать стоимость услуги'''API key''' - string, used for reseller's ID in API requests* активировать услугу для конкретного пользователя* получить список услуг'''API secret''' - secret key, активных для конкретного пользователя в данный моментused for a digital signature of API requests
Техническую спецификацию You can find these identifiers in section Reseller -> API можно посмотреть [[Reseller settings in a left menu. The reseller can change a secret key by themselves (button "Edit API|здесь]]settings").
==Как получить доступ к API для реселлеровCreating apps==Когда пользователь Ace Stream становится партнером, он автоматически становится клиентом API и ему предоставляется доступ к API в виде двух идентификаторов:* '''To start working with API key''' for resellers you have to create at least one app. To do this click button "Create a new application" in section Reseller - строка, которая используется для идентификации партнера в запросах API* '''API secret> Applications in the left menu. After this you will be proposed to fill fields "Name" (mandatory) and "Application''' - секретный ключ, который используется для цифровой подписи запросов APIs site"(optional).
Секретный ключ партнер может поменять самостоятельно в админAll your apps can be seen in section Reseller -панели.> Applications in a table with the following fields:* Name - app's name that you specified when created the app* APP_ID - app's identifier (it is used in API requests)* Edit - edit the app (you can change app's name and site)* OAuth - edit settings OAuth of this app* API - open API-console of this app
==Как работает схема для реселлеров==ПредположимYou will need OAuth settings only if you plan to identify users using OAuth2 technology (usually, что пользователь test@someservice.com решил стать партнером Ace Stream и продавать пользователям услугу "No ADs" (отключение рекламы Ace Streamit is necessary for sites' owners).
Для этого пользователю необходимо:* зарегистрироваться на в системе Ace Stream* стать партнером, подтвердив свое согласие с условиями "Партнерского соглашения"* создать новое приложение API-console allows you to send requests on behalf of your application directly from site. The console is intended primarily to demonstrate the formation of requests to API (партнер может создать несколько приложений; каждое приложение имеет свое название, адрес сайта и идентификатор OAuth2each request and response appear in text fields at the bottom of the page).
Для того<span style="color: #a00;">Attention!</span> API-console is not an emulator of requests - all requests are real and are sent to production-servers. It means that when some paid option is activated from console money will be withdrawn from your balance. If you would like to work with API for resellers in a test mode, чтобы продать услугу пользователю, реселлер должен отправить use [[Reseller_API_Sandbox|sandbox]]. ==Options activation reminder==App engine can notice user about missing options. Notification method depends on API you choose:* more about Engine API [[Engine_API#example-missing-option-on-start|here]]* more about HTTP API[[Engine_HTTP_API#stop-запрос с такими даннымиnotifications|here]] ==Activation of options for users==To activate the option for user reseller has to call API method [[Reseller_API#activateService|activateService]] with the following data:
* API key
* APP_ID (application identifier)* user key* option ID* ID of period for which an option has to be activated If the request was successful a certain amount of money will be charged from reseller's balance, and the option for the requested period will be activated. If a specified option is already activated at this moment, then validation period of the option will continue for a stated period. API Key and APP_ID you can find out on the site in section [https://accounts.acestream.net/reseller Reseller]. Identifiers of options and periods are described [[Reseller_API|here]] As it is seen from the description, to activate options reseller has to know user key. This key can be obtained in two ways: either via OAuth2 protocol, or to create a new key using API for resellers. The first method is more suitable for sites' owners. The second - for apps' developers. Both methods are described below. ==Work scheme for sites' owners==Sites' owners can get user key using OAuth2 Client IDprotocol. To do this they have to do the following steps:* reseller places on his site a button "Log in with Ace Stream"* after pressing this button everything goes according to OAuth2:** user is redirected to Ace Stream site** if he's not registered, he registers** if he's registered, but not logged in, he logs in** if user logs in to reseller's site via Ace Stream OAuth2 at the first time, he agrees to provide some of his personal data to reseller's site (email and user key)* ключ пользователя* user goes back to reseller's site* идентификатор услуги* reseller's site receives email and user key according to OAuth2* идентификатор периодаnow user is authorized at reseller's site, and the reseller has user key, на который необходимо активировать услугуby which he can activate the option for user More detailed information about OAuth2 is [[OAuth2/en|here]].
При успешном выполнении запроса с баланса партнера будет списана определенная сумма, а у пользователя активируется услуга на указанный период==Work scheme for apps' developers==Apps' developers usually have access to [[Engine_Service_API/en|Engine service API]]. It gives them ability to upload user keys directly to Ace Stream Engine and activate options without direct user intervention.
Как видно из описания, для активации услуги реселлер должен знать ключ пользователя. Этот ключ реселлер может получить по протоколу OAuth2.Для этогоWe propose the following work scheme:* реселлер на своем сайте размещает кнопку "Войти через Ace Stream", которая выполняет авторизацию пользователя по протоколу OAuth2app checks whether the required option is activated ([[Engine_Service_API#check_user_service|check_user_service]])* после нажатия на эту кнопку все проходит согласно OAuth2:** пользователя перенаправляет на сайт Ace Stream** если он не зарегистрированif the option is not activated, то регистрируется** если зарегистрирован, но не залогинен, то выполняет процедуру входа** если пользователь первый раз входит на сайт реселлера через app creates a new user key ([[Reseller_API#createUserKey|createUserKey]]) and uploads it to Ace Stream OAuth2, то он дает свое согласие на предоставление некоторых персональных данных сайту реселлера Engine (email и ключ пользователя[[Engine_Service_API#load_extension|load_extension]])** пользователь возвращается на сайт реселлера** сайт реселлера получает email и ключ пользователя согласно OAuth2app activates a required option for a new user key ([[Reseller_API#activateService|activateService]])
* теперь пользователь авторизирован на сайте реселлера и у реселлера есть ключ пользователя, по которому он может активироватьему услугуDescribed scheme assumes that reseller's app and Ace Stream Engine are run on the same device.

Navigation menu