Skip to content

marchitos/soccerama

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soccerama new Sportmonks

Sportmonks API for v1.1, v1.2 and v2.0

travis build codecov coverage version downloads MIT License

installation

npm install soccerama

import

ES6

import { Soccerama } from 'soccerama';
const soccerama = new Soccerama(__YOUR_API_TOKEN__, 'v2.0');

CommonJS

var Soccerama = require('soccerama').Soccerama;
var soccerama = new Soccerama(__YOUR_API_TOKEN__, 'v2.0');

usage

var soccerama = new Soccerama(__YOUR_API_TOKEN__, 'v2.0'); // if second param is omitted api v1.2 will be used

soccerama.get(endpoint,params).then( function(data){
    console.log(data);
});

endpoint

you can get the endpoint from the official soccerama documentation omitting the base url and the parameters (that are set with the params field)

soccerama.get('countries').then( function(data){
    console.log(data)
});

params

if you need to specify parameters you can set the params field as follow

soccerama.get('countries/{id}', { id: 13, competitions: true }).then( function(data){
    //id in the params field will replace {id} in the endpoint
    //competitions: true, will add include=competitions in query string
});