Api Docs

Get started

Tuin-API has public and private connection.
Public calls only shows limites non-confidential data of the club is designed for club's public webpage.
Private calls require authentification to get full data.

Headers


  • Content-Type

    application/json

  • X-Access-Token

    Provided as token on login call

  • Accept-Language

    Responses will return translated slugs into selected language (error messages will always be in English)

    • Default: es_ES
    • Available: es_ES, en_US
  • Alowed Methods

    GET, PUT, POST, PATCH, DELETE, OPTIONS

    General filters


  • season

    At any call you can set past seasons (for records)

    • Default: current season (configured on club’s data)
    • Available: 1011, 1112current

Public / Private Calls

  • **Public call **

    /:clubDomain/callName?filters

  • **Private call ** X-Access-Token required

    /callName?filters

    Login


Returns json with user data, permisions and auth token (expires in 10 hours)
  • URL

    /login

  • Method:

    POST

  • URL

    • Params
      none
      
    • Filters
      none
      
    • Data
      raw | application/json
      

      json
      {
      "userName": "userName",
      "password": "SHA1 encoded password",
      "domain": "Club's domain"
      }

  • Success Response:

    • Code: 200
    • Content:
      json
      {
      "success": true,
      "token": "accessToken",
      "userInfo": { ... }
      }
  • Error Response:
    • Code: 404 NOT FOUND
    • Content:
      json
      {
      "success": false,
      "message": "club's domain doesn't found"
      }

    OR

    • Code: 401 UNAUTHORIZED
    • Content:
      json
      {
      "success": false,
      "message": "user doesn't exist or email doesn't match"
      }

    OR

    • Code: 401 UNAUTHORIZED
    • Content:
      json
      {
      "success": false,
      "message": "inactive user"
      }

    people


Returns json data with club's people, players, directors, coaches and members
  • URL

    Private: /people

    Public: /:clubDomain/people

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • teamId=[integer]
      • playerId=[integer]
      • gender=[string] (“M” or “F”)
      • birthYear=[integer]
      • nextBirthdays=[integer] (1 to get today birthDays, 3 to get next 3 day birthDays)
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    
  • Error Response:
    • Code: 401 UNAUTHORIZED
    • Content:
    {
      "success": false,
      "message": "failed to authenticate token."
    }
    

    OR

    • Code: 400 BAD REQUEST
    • Content:
    {
      "Error": true,
      "Message": "invalid domain"
    }
    

    teams


Returns json data with team info
  • URL

    Public: /:clubDomain/teams

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • teamId=[integer]
      • clubTeams=[boolean] [show teams of the club or external teams] (default true)
      • showMembers=[boolean] [show team members players and staffs] (default false)
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    
  • Error Response:
    • Code: 400 BAD REQUEST
    • Content:
    {
      "Error": true,
      "Message": "invalid domain"
    }
    

    competitions


Returns json data with competition info
  • URL

    Public: /:clubDomain/competitions

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • competitionId=[integer]
      • categoryId=[integer]
      • sportId=[integer]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    
  • Error Response:
    • Code: 400 BAD REQUEST
    • Content:
    {
      "Error": true,
      "Message": "invalid domain"
    }
    

    categories


Returns json data with categories info
  • URL

    Public: /:clubDomain/categories

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • categoryId=[integer]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    
  • Error Response:
    • Code: 400 BAD REQUEST
    • Content:
    {
      "Error": true,
      "Message": "invalid domain"
    }
    

    links


Returns json data with club links
  • URL

    Public: /:clubDomain/links

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • linkId=[integer]
      • categoryId=[integer]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    
  • Error Response:
    • Code: 400 BAD REQUEST
    • Content:
      json
      {
      "Error": true,
      "Message": "invalid domain"
      }

    news


Returns json data with all club's news available
  • URL

    Public: /news

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • newId=[integer]
      • new=[string]
      • authorId=[integer]
      • author=[string]
      • lang=[string] [en / es]
      • teamId=[integer]
    • Pagination:
      • registers=[integer] [default 10]
      • page=[integer] [default 1]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    

    facilities


Returns json data with all facilities available
  • URL

    Public: /facilities

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • facilityId=[integer]
      • facilityName=[string]
    • Pagination:
      • registers=[integer] [default 10]
      • page=[integer] [default 1]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    

    pages


Returns json data with all custom pages available
  • URL

    Public: /pages

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • pageId=[integer]
      • lang=[string]
      • pageUrl=[string]
    • Pagination:
      • registers=[integer] [default 10]
      • page=[integer] [default 1]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    

    calendar


Returns json data with all games depending on filter
  • URL

    Public: /calendar

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • competitionId=[integer]
      • gameDay=[integer]
      • onlyClub=[boolean] (Shows only club team games)
      • teamId=[integer] (shows games for selected team)
      • date=[dateString] [yyyy-mm-dd]
      • nDays=[integer] [show next n games with selected filters]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]
    

    standings


Returns json data with standings of a specific competition
  • URL

    Public: /standings/:competitionId

  • Method:

    GET

  • URL

    • Params
      • competitionId=[integer]
    • Filters
      • gameDay=[integer]
      • showAll (if this filter is set, shows all gameDays) [default: last gameDay]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "group:" string, ... },
      { "group:" string, ... },
      ...
    ]
    

callup


Returns json data with callup data and players called
  • URL

    Public: /callup/:gameId/:teamId

  • Method:

    GET

  • URL

    • Params
      • gameId=[integer] [Mandatory]
      • teamId=[integer] [Mandatory]
    • Filters
      none
      
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
      {"data": {
        "clothes": "...",
        "meetTime": "10:30",
        "meetPlace": "...",
        "comments": "..."
      },
      "players": [
        {
          "stats": "...",
          "createdAt": "2015-10-02T19:07:57.000Z",
          "responseAt": "2015-10-04T06:41:48.000Z",
          "sentAt": "2015-10-02T21:10:09.000Z",
          ...
        },
        {...}
      ]
    }
    

    sports


Returns json data with all tuintra's sports available
  • URL

    Public: /sports

  • Method:

    GET

  • URL

    • Params
      none
      
    • Filters
      • sportId=[integer]
    • Data
      none
      
  • Success Response:
    • Code: 200
    • Content:
    [
      { "_id:" int, ... },
      { "_id:" int, ... },
      ...
    ]