MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Search_API",
        "continue": "gapcontinue||"
    },
    "query": {
        "pages": {
            "66": {
                "pageid": 66,
                "ns": 0,
                "title": "Reseller API",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "==Common description of API==\nThis API allows you to work with user keys in Ace Stream system. API provides methods to create user keys and activate different options for the keys.\n\n==Requests format==\nAPI requests are sent via HTTP-GET method to the following addresses:\n* test mode: <tt><nowiki>https://api-sandbox.acestream.net/reseller</nowiki></tt>\n* work mode: <tt><nowiki>https://api.acestream.net/reseller</nowiki></tt>\n\nResponses for these requests comes in json format.\n\nIf during query processing an error was occurred, the following kind of response will be sent:\n <tt><nowiki>{\"error\":\"error descrtiption\"}</nowiki></tt>\n\nResponses to successfully processed requests depend on a method being called\n\n===Required common parameters for all requests===\n* '''method''' - called API method\n* '''api_key''' - API client key\n* '''api_version''' - supported API version (current version: 1.0)\n* '''app''' - market ID\n* '''sign''' - request's digital signature\n\n===Algorithm for generating a digital signature===\n* array of strings like \"parameter_name=parameter_value\" is created\n* the resulting array is sorted\n* elements of the sorted array are combined in a string with a separator \"#\"\n* private key of API client is added to the resulting string\n* signature is sha1-hash of the resulting string (in hexadecimal representation, 40 characters, lowercase)\n\nPHP code:\n <tt><nowiki>function makeSignature(array $params, $apiSecret)\n{\n    $checkParams = array();\n    foreach($params as $k => $v) {\n        $checkParams[] = $k . '=' . $v;\n    }\n    sort($checkParams);\n    \n    $payload = join('#', $checkParams);\n    $sign = sha1($payload . $apiSecret);\n    \n    return $sign;\n}</nowiki></tt>\n\n==API methods==\n\n===getServiceCost===\nGet the cost of a service\n\nparameters:\n* '''service''' (''string'') - service ID\n* '''period''' (''string'') - period ID\n\nfields in response:\n* '''cost''' (''decimal'') - the cost of the service for a specified period in EUR\n\nrequest example:\n <nowiki>https://api.acestream.net/reseller?method=getServiceCost &crarr;\n  &api_version=1.0 &crarr;\n  &api_key=be6f66e0848528139583b567fb222215444fc8ac &crarr;\n  &app=9_50gh753t6uscog88800kcksw04s0o0wccscco8kgsogwkocwgw &crarr;\n  &service=noAds &crarr;\n  &period=m1 &crarr;\n  &sign=45c84ceffd3ec443586e8f4666b28abde8400768</nowiki>\n\nresponse:\n <nowiki>{\"cost\":1}</nowiki>\n\n===activateService===\nActivate service for user\n\nAs a result of successful activation, funds will be charged from reseller's balance.\n\nparameters:\n* '''user_key''' (''string'') - user key\n* '''service''' (''string'') - service ID\n* '''period''' (''string'') - period ID\n\nfields in response:\n* '''validFrom''' (''unix timestamp'') - from what time service is active\n* '''validTo''' (''unix timestamp'') - till what time service will be active\n\nrequest example:\n <nowiki>https://api.acestream.net/reseller?method=activateService &crarr;\n  &api_version=1.0 &crarr;\n  &api_key=be6f66e0848528139583b567fb222215444fc8ac &crarr;\n  &app=9_50gh753t6uscog88800kcksw04s0o0wccscco8kgsogwkocwgw &crarr;\n  &user_key=a455865e5800fd7efab75f2b4852fc2497f9fc39 &crarr;\n  &service=noAds &crarr;\n  &period=m1 &crarr;\n  &sign=c4df772a4a41ad7bbb4d7d07e46cad5e3622c59e</nowiki>\n\nresponse (successful activation):\n <nowiki>{\"validFrom\":1376048972,\"validTo\":1378640972}</nowiki>\n\nresponse (there are not enough funds on resellers balance to activate the service):\n <nowiki>{\"error\":\"not enough credits\"}</nowiki>\n\n===getUserKeyInfo===\nGet information about user key\n\nparameters:\n* '''user_key''' (''string'') - user key\n\nfields in response:\n* '''services''' (''array'') - array of services, bound to this user key. Each service ia described with the following fields:\n** '''id''' (''string'') - service ID\n** '''validFrom''' (''unix timestamp'') - from what time service is active\n** '''validTo''' (''unix timestamp'') - till what time service will be active\n** '''enabled''' (''boolean'') - is service active at this moment\n\nrequest example:\n <nowiki>https://api.acestream.net/reseller?method=getUserKeyInfo &crarr;\n  &api_version=1.0 &crarr;\n  &api_key=be6f66e0848528139583b567fb222215444fc8ac &crarr;\n  &app=9_50gh753t6uscog88800kcksw04s0o0wccscco8kgsogwkocwgw &crarr;\n  &user_key=8fb311be3836b04f61817dbf8a23c05739ebb13e &crarr;\n  &sign=5e0fc46d908e5f224ce9fce9f6a83dd6b3502cc0</nowiki>\n\nresponse (no services):\n <tt>{\"services\":[]}</tt>\n\nresponse (there are services):\n <nowiki>{\"services\": [\n     {\"id\": \"noAds\", \"validFrom\": 1374673235, \"validTo\": 1445089235, \"enabled\": true},\n     {\"id\": \"premium\", \"validFrom\": 1374858187, \"validTo\": 1448301787, \"enabled\": true}\n ]}</nowiki>\n\n\n===createUserKey===\nCreate a new user key\n\nfields in response:\n* '''userKey''' (''string'') - created user key\n* '''extension''' (''string'') - content of extension file which is used for the following loading to the engine\n\nrequest example:\n\n <nowiki>https://api.acestream.net/reseller?method=createUserKey &crarr;\n  &api_key=cd3119af58cfa8833ba105a4fd4eb791395b921c &crarr;\n  &api_version=1.0 &crarr;\n  &app=3_250o55jdisu88skggogg4g4w4wc8wgskss4gkgkkk40k0gcsw8 &crarr;\n  &sign=99982a11708ef4a80e12f1ca845d314340db8869</nowiki>\n\nresponse:\n <tt>{\n  \"userKey\": \"c7456d962209ce22a8edd0c788940a15792bc575\",\n  \"extension\": \"F5T6L+X\\/TnhqoXP\\/Tyzlad51LoGI3InF676iap &crarr;\n n6vuJUOLbFJNGfYQcakQMXAhSTrlc7XlmUydoGcnCXhw5qefoinHZHIL &crarr;\n VW51Pd5I0\\/0YbKsmn\\/Y78F1JhG1ckBExCtQTf\\/NgLj+8TeTyPOfQS &crarr;\n lRub3k4G\\/m0+Iqyq4hshKnmTIBlkDcytWZ5DyQFLetllUUz9rLFjvR8 &crarr;\n mF0qy3GCYtAw==\"\n }</tt>\n\n==Service ID==\n* '''noAds''' - service \"No ADs\" (disable Ace Stream ads)\n* '''premium''' - service \"Premium Streams\" (access to premium content)\n* '''premium1device''' - premium for one device\n* '''proxyServer''' - \"Proxy Server\" option (it allows using Ace Stream by third-party software products)\n\n==Period ID==\n* '''m1''' - 30 days\n* '''y1''' - 365 days"
                    }
                ]
            },
            "65": {
                "pageid": 65,
                "ns": 0,
                "title": "Resellers",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "==Terms==\n* '''Reseller''' \u2013 Ace Stream user who has got rights to sell paid Ace Stream options\n* '''User key''' - Ace Stream user's ID\n* '''Option''' - additional service / software service of Ace Stream, which can be activated for a specific user key \n* '''App''' - reseller's product (site, mobile or desktop application), which is used to sell options\n\n==How to become a reseller==\n* log in to site https://accounts.acestream.net using your login (if you do not have the login, you have to [https://accounts.acestream.net/register register])\n* choose section [https://accounts.acestream.net/partnership \"Partnership\"] in a top menu\n* click button \"Become a reseller\"\n\n==API for Resellers==\nAPI for resellers allows you to activate different additional options for users of your apps.\n\nA common scheme of work of API for resellers looks like this:\n* 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\n* the cost of specified option for the specified period is charged from your balance in Ace Stream system\n* specified option is activated for the user whose id you specified in the request\n\nFull description of API for resellers you can find [[Reseller_API|here]].\n\nTo work with API you will need the following two identifiers:\n* '''API key''' - string, used for reseller's ID in API requests\n* '''API secret''' - secret key, used for a digital signature of API requests\n\nYou can find these identifiers in section Reseller -> API settings in a left menu. The reseller can change a secret key by themselves (button \"Edit API settings\").\n\n==Creating apps==\nTo start working with API for resellers you have to create at least one app. To do this click button \"Create a new application\" in section Reseller -> Applications in the left menu. After this you will be proposed to fill fields \"Name\" (mandatory) and \"Application's site\"(optional).\n\nAll your apps can be seen in section Reseller -> Applications in a table with the following fields:\n* Name - app's name that you specified when created the app\n* APP_ID - app's identifier (it is used in API requests)\n* Edit - edit the app (you can change app's name and site)\n* OAuth - edit settings OAuth of this app\n* API - open API-console of this app\n\nYou will need OAuth settings only if you plan to identify users using OAuth2 technology (usually, it is necessary for sites' owners).\n\nAPI-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 (each request and response appear in text fields at the bottom of the page).\n\n<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]].\n\n==Options activation reminder==\nApp engine can notice user about missing options. Notification method depends on API you choose:\n* more about Engine API  [[Engine_API#example-missing-option-on-start|here]]\n* more about HTTP API [[Engine_HTTP_API#stop-notifications|here]]\n\n==Activation of options for users==\nTo activate the option for user reseller has to call API method [[Reseller_API#activateService|activateService]] with the following data:\n* API key\n* APP_ID (application identifier)\n* user key\n* option ID\n* ID of period for which an option has to be activated\n\nIf 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.\n\nIf a specified option is already activated at this moment, then validation period of the option will continue for a stated period.\n\nAPI Key and APP_ID you can find out on the site in section [https://accounts.acestream.net/reseller Reseller].\n\nIdentifiers of options and periods are described [[Reseller_API|here]]\n\nAs 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.\n\n==Work scheme for sites' owners==\nSites' owners can get user key using OAuth2 protocol. To do this they have to do the following steps:\n* reseller places on his site a button \"Log in with Ace Stream\"\n* after pressing this button everything goes according to OAuth2:\n** user is redirected to Ace Stream site\n** if he's not registered, he registers\n** if he's registered, but not logged in, he logs in\n** 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)\n** user goes back to reseller's site\n** reseller's site receives email and user key according to OAuth2\n* now user is authorized at reseller's site, and the reseller has user key, by which he can activate the option for user\n\nMore detailed information about OAuth2 is [[OAuth2/en|here]].\n\n==Work scheme for apps' developers==\nApps' 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.\n\nWe propose the following work scheme:\n* app checks  whether the required option is activated ([[Engine_Service_API#check_user_service|check_user_service]])\n* if the option is not activated, app creates a new user key ([[Reseller_API#createUserKey|createUserKey]]) and uploads it to Ace Stream Engine ([[Engine_Service_API#load_extension|load_extension]])\n* app activates a required option for a new user key ([[Reseller_API#activateService|activateService]])\n\nDescribed scheme assumes that reseller's app and Ace Stream Engine are run on the same device."
                    }
                ]
            }
        }
    }
}