maxtv-api
Introduction
maxtv-api is the API of maxtv-labs, available at https://api.maxtv.fr.
What is an API ?
An API (Application Program Interface) is a set of routines, protocols, and tools for building software applications.
Basically, an API specifies how software components should interact.
Additionally, APIs are used when programming graphical user interface (GUI) components.
A complete overview of the maxtv-api functionalities is available with maxtv-api-explorer tool (based on swagger-ui).
Note : this overview is complete only if you're logged with your maxtv account.
Rules
maxtv-api is compatible with OAuth 2.0 for some specific scopes.
OAuth 2.0 is the industry-standard protocol for authorization.
maxtv-api follows this naming convention for the API url : {scheme}://{host}/{scope}/{function}.{format}
{sheme}
It's the protocole scheme of an url : http or https
{host}
It's the server address : api.maxtv.fr or api.max-tv.be
{scope}
A scope is a mechanism in OAuth 2.0 to limit an application's access to a user's account.
In maxtv-api, it's also a list of functions.
You can find all scopes available in the maxtv-api-explorer tool.
{function}
the name of a function available in the scope.
You can find all function available in the maxtv-api-explorer tool.
{format}
in maxtv-api, the output format is generally json or xml, but some specific function can output an other format.
You can find the output format for each functions in the maxtv-api-explorer tool.
Examples :
https://api.maxtv.fr/user/browser.json
{sheme} : https | {host} : api.maxtv.fr | {scope} : user | {function} : browser | {output} : json
https://api.maxtv.fr/user/browser.xml
{sheme} : https | {host} : api.maxtv.fr | {scope} : user | {function} : browser | {output} : xml
api.js
api.js is a javascript method provided by maxtv-labs to query maxtv-api
How to use api.js :
1 - load api.js
<script src="//api.maxtv.fr/sdk/api-1.0.0.js"></script>
<script>
var api = new maxtv_api_object();
api.host = 'api.maxtv.fr';
api.client_id = 'my_client_id';
api.scope = 'user';
api.key = 'my_api_key';
</script>
2 - query the maxtv-api with api.get method
<script>
api.get('//' + api.host + '/user/ip.json', function(data){
console.log(data);
}, function(data){
console.error(data);
});
</script>
3 - query the maxtv-api with api.call method
<script>
api.call('user', 'ip', function(data){
console.log(data);
}, function(data){
console.error(data);
});
</script>