@elenasport/sports-api
ElenaSport.io Nodejs SDK - Sports API
Last updated 5 months ago by elenasport .
MIT License · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @elenasport/sports-api 
SYNC missed versions from official npm registry.

logo

ElenaSport.io: Your fast, reliable and affordable sports data provider

GETTING STARTED

Prerequisites

First of all, you are asked for opening an account on RapidApi website to get your API KEY.

Remember, the API KEY is highly confidential and it should never be used by anyone but you.

Installing

This is a Node.js module available through the npm registry. Installation is done using the npm install command:


$ npm i @elenasport/sports-api

API

Import the @elenasport/sports-api module inside your modules and create the object with the new keyword


var ElenaSport = require('@elenasport/sports-api')
var elenaSport = new ElenaSport('***YOUR_API_KEY***')

To call our endpoints, use the get function. This function will return a resolved promise whether the call to the endpoint is successfully performed, otherwise it will throw an error


elenaSport.get(endpoint, params)

Find out the complete list of endpoints and params on our API Documentation

Example of successful call


{
   "results":[
      {
         "id":10,
         "name":"Belgium"
      },
      {
         "id":20,
         "name":"Croatia"
      },
      {
         "id":23,
         "name":"Denmark"
      },
      {
         "id":27,
         "name":"England"
      },
      {
         "id":31,
         "name":"France"
      },
      {
         "id":32,
         "name":"Germany"
      },
      {
         "id":45,
         "name":"Italy"
      },
      {
         "id":47,
         "name":"Japan"
      },
      {
         "id":58,
         "name":"Netherlands"
      },
      {
         "id":62,
         "name":"Norway"
      },
      {
         "id":67,
         "name":"Portugal"
      },
      {
         "id":80,
         "name":"Spain"
      },
      {
         "id":89,
         "name":"USA"
      },
      {
         "id":2,
         "name":"Austria"
      },
      {
         "id":13,
         "name":"Brazil"
      },
      {
         "id":34,
         "name":"Greece"
      }
   ]
}

Example of failed call


{
  "status": 404,
  "type": "NotFoundError",
  "message": "Route not found - Welcome to ElenaSport.io - You're fast, reliable and affordable sport data provider. Please navigate to https://elenasport.io to get started",
  "requestId": "298b3f50-93e8-4036-a1c6-193e0fc0219f"
}

Running example


var ElenaSport = require('sports-api')
var elenaSport = new ElenaSport('PUT_YOUR_REFRESH_TOKEN_HERE')

var params = {
    page: 1
}

elenaSport.get('countries', params)

    .then(response => {
        console.log(response)
    })

    .catch(err => {
        console.log(err)
    })

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Current Tags

  • 0.1.3                                ...           latest (5 months ago)

2 Versions

  • 0.1.3                                ...           5 months ago
  • 0.1.2                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 1
Dependencies (1)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |