LogoLogo
PAO DocsCommunity DocsDeveloper DocsPeerplays.com
  • Infrastructure Documentation
  • The Basics
    • Peerplays Node Types
    • Hardware Requirements
    • Obtaining private keys for cli_wallet
    • Using the CLI Wallet
      • CLI Wallet Fundamentals
      • CLI Commands for All Nodes
      • CLI Commands for Witnesses
      • CLI Commands for SONs
        • Updated CLI commands for SON voting
      • Deriving Keys using CLI Wallet
    • Auto-Starting a Node
    • Backup Servers
    • Obtaining Your First Tokens
    • Updating a Witness Node
    • How to create a Peerplays Account?
  • Advanced Topics
    • Private Testnets
      • Peerplays QA environment
      • Private Testnets - Manual Install
    • Reverse Proxy for Enabling SSL
    • Enabling Elasticsearch on a Node
    • Introduction to Faucet
  • Witnesses
    • What is a Witness node?
    • Installation Guides
      • Build and Install
      • Docker Install
      • GitLab Artifact Install
    • How to become a block producing witness?
    • Other Ways to configure a witness node
      • Peerplays API nodes & Installation Guide
      • Configuring Witness Node as Delayed Node
    • What's Next?
  • Sidechain Operator Nodes (SONs)
    • Installation Guides
      • Manual Install
      • Docker Install
      • SON Configuration - Version 1.5.19
      • SON configuration - Version 1.6.0
      • Bitcoin-SONs Sanity Checks
      • ETH-SONs Configuration & Installation
      • Existing SON node upgrade
  • Bookie Oracle Suite (BOS)
    • Introduction to BOS
    • BOS Installation
      • Installing MongoDB
      • Installing Redis
      • Configuration of bos-auto
      • Spinning Up bos-auto
    • BookieSports
      • Installing Bookiesports
      • Synchronizing BOS with BookieSports
      • BookieSports Module Contents
        • Sub Modules
      • Schema
      • Naming Scheme
    • Manual Intervention Tool (MINT)
      • Installing MINT
      • Introduction
  • DATA PROXIES
    • Introduction to Data Proxies
    • How Data Proxies Work
    • Data Proxy Set Up
  • COUCH POTATO
    • Installation
    • Functional Requirements
      • Flow Diagrams
      • Home Page
      • Create Account
      • Dashboard
        • Header
        • Sports Tabs
        • League Tabs
        • Calendar
        • Notifications
        • Replay
        • Account Menu
      • Game Selector
      • Change Password
    • Help
      • User Guide
        • Introduction
        • Home Page
        • Creating an Account
        • Dashboard
          • Replay
          • Account Menu
            • Change Password
        • Game Selector
    • Database
      • Schema
      • Objects
        • Tables
        • Views
    • API
      • Using the API
      • API Reference
        • Objects
        • Error Codes
      • BOS Schema
    • Proxy Payment Considerations
  • Other Documentation
    • Peerplays Home
    • Community Docs
    • Developer Docs
    • Site Reliability Engineering
Powered by GitBook
On this page
  • add_game
  • start_game
  • add_score
  • finish_game
  • cancel_game
  • delete_event
  • delete_game
  • get_all_data_by_date_range
  • get_all_games
  • get_all_sports
  • get_games_by_league_and_date
  • get_games_by_league
  • get_leagues_by_sport
  • get_sports_and_leagues
  • get_teams_by_league
  • get_league_data_by_name
  • last_event_id_by_date_and_league
  • last_event_id
  • last_game_id_by_date_and_league
  • last_game_id
  • last_game
  • run_replay

Was this helpful?

Export as PDF
  1. COUCH POTATO
  2. API

API Reference

PreviousUsing the APINextObjects

Last updated 2 years ago

Was this helpful?

add_game

Adds a new game and sends a create incident message to BOS.

POST /add_game/:create_message
  • create_message: Object of type

  • Success

  • Failure

    • status: 400: Bad Request

    • subcode: One of Error Objects

    • title: One of Error Objects

    • message: One of Error Objects

Error Objects

var http: HttpClient;
var headers = new HttpHeaders({'Content-Type' : 'application/json'});
var postData:any = {};
postData.sport = "Soccer";
postData.league = "EPL";
postData.user = 1;
postData.home = "Chelsea";
postData.away = "Manchester United";
postData.start_time = "2020-02-04T18:33:00Z";
http.post(url + "add_game.php?" , postData, {headers}).map();

start_game

Starts an existing game and sends an in_progress incident message to BOS.

POST /start_game/:in_progress_message
  • in_progress_message: Object of type

  • Success

  • Failure

    • status: 400: Bad Request

    • subcode: One of Error Objects

    • title: One of Error Objects

    • message: One of Error Objects

Error Objects

var http: HttpClient;
var headers = new HttpHeaders({'Content-Type' : 'application/json'});
var postData:any = {};
postData.sport = "Soccer";
postData.league = "EPL";
postData.user = 1;
postData.home = "Chelsea";
postData.away = "Manchester United";
postData.start_time = "2020-02-04T18:33:00.000Z";
postData.whistle_start_time = "2020-02-04T18:45:00.000Z";
postData.match_id: 24;
http.post(url + "start_game.php?" , postData, {headers}).map();

add_score

Add scores to a game.

POST /add_score/:result_message
  • result_message: Object of type

  • Success

  • Failure

    • status: 400: Bad Request

    • subcode: One of Error Objects

    • title: One of Error Objects

    • message: One of Error Objects

Error Objects

var http: HttpClient;
var headers = new HttpHeaders({'Content-Type' : 'application/json'});
var postData:any = {};
postData.sport = "Soccer";
postData.league = "EPL";
postData.user = 1;
postData.home = "Chelsea";
postData.away = "Manchester United";
postData.start_time = "2020-02-04T18:33:00.000Z";
postData.home_score = 4;
postData.away_score = 2;
postData.match_id: 24;
http.post(url + "add_score.php?" , postData, {headers}).map();

finish_game

Finish a game

POST /finish_game/:finish_game_message
  • Success

  • Failure

    • status: 400: Bad Request

    • subcode: One of Error Objects

    • title: One of Error Objects

    • message: One of Error Objects

Error Objects

var http: HttpClient;
var headers = new HttpHeaders({'Content-Type' : 'application/json'});
var postData:any = {};
postData.sport = "Soccer";
postData.league = "EPL";
postData.user = 1;
postData.home = "Chelsea";
postData.away = "Manchester United";
postData.start_time = "2020-02-04T18:33:00.000Z";
postData.whistle_end_time = "2020-02-04T20:33:00.000Z";
postData.match_id: 24;
http.post(url + "finish_game.php?" , postData, {headers}).map();

cancel_game

Cancel a game

POST /add_score/:cancel_game_message
  • Success

  • Failure

    • status: 400: Bad Request

    • subcode: One of Error Objects

    • title: One of Error Objects

    • message: One of Error Objects

Error Objects

var http: HttpClient;
var headers = new HttpHeaders({'Content-Type' : 'application/json'});
var postData:any = {};
postData.sport = "Soccer";
postData.league = "EPL";
postData.user = 1;
postData.home = "Chelsea";
postData.away = "Manchester United";
postData.start_time = "2020-02-04T18:33:00.000Z";
postData.match_id: 24;
http.post(url + "cancel_game.php" , postData, {headers}).map();

delete_event

Delete an event according to the league and date.

DELETE /delete_event/:date/:league
  • date: The date of the event. Format is YYYY-MM-DD (UTC)

  • league: The name of the league

  • Success - 200

    • title: League Deleted

    • message:[league]

  • Failure - 400

var http: HttpClient;
var headers = new HttpHeaders({'Content-Type' : 'application/x-www-form-urlencoded'});
let httpParams = new HttpParams().set('date', '2020-02-29', 'league', 'EPL');
return http.delete(url + "delete_event.php", { 
        params: httpParams, headers: headers});

delete_game

Delete an event according to the league and date.

DELETE /delete_game/:game_id
  • game_id: The id of the game to be deleted.

  • Success - 200

    • title: League Deleted

    • message:[league]

  • Failure - 400

var http: HttpClient;
var headers = new HttpHeaders({'Content-Type' : 'application/x-www-form-urlencoded'});
let httpParams = new HttpParams().set('game_id', 24);
return this.http.delete(this.url + "delete_game.php", { 
        params: httpParams, headers: headers});

get_all_data_by_date_range

Get all games data between a date range.

GET /get_all_data_by_date_range/:start_date/:end_date
  • start_date: The start of the date range. Format is YYYY-MM-DDTHH:MM:SS.000Z

  • end_date: The end of the date range. Format is YYYY-MM-DDTHH:MM:SS.000Z

  • Success - 200

    • List of all games between start_date and end_date

  • Failure - 400

http.get(url + "get_all_data_by_date_range.php", {
        params:{startdate: "2020-02-19T12:00:00.000Z", 
                enddate: "2020-02-29T12:00:00.000Z"}}).map();

get_all_games

Get all games.

GET /get_all_games/
  • Success - 200

    • List of all games

  • Failure - 400

http.get(url + "get_all_games.php").map()

get_all_sports

Get all sports.

GET /get_all_sports/
  • Success - 200

    • List of all sports

  • Failure - 400

http.get(url + "get_all_sports.php").map()

get_games_by_league_and_date

Get all games data between a date range and for a league.

GET /get_games_by_league_and_date/:league/:start_date/:end_date
  • league: The sport league (event group).

  • start: The start of the date range. Format is YYYY-MM-DDTHH:MM:SS.000Z.

  • end: The end of the date range. Format is YYYY-MM-DDTHH:MM:SS.

  • Success - 200

    • List of all games for league between start and end

  • Failure - 400

http.get(url + "get_games_by_league_and_date.php", {
        params:{league: "NFL",
                startdate: "2020-02-19T12:00:00.000Z", 
                enddate: "2020-02-29T12:00:00.000Z"}}).map();

get_games_by_league

Get all games for a league.

GET /get_games_by_league/:league
  • league: The league (event group).

  • Success - 200

    • List of all games for league

  • Failure - 400

http.get(url + "get_games_by_league.php", {
        params:{league: "NFL" }}).map();

get_leagues_by_sport

Get all leagues from a league.

GET /get_leagues_by_sport/:sport
  • sport: The id of the sport.

  • Success - 200

    • List of all leagues for sport

  • Failure - 400

http.get(url + "get_leagues_by_sport.php", {
        params:{sport: 0}}).map();

get_sports_and_leagues

Get all sports and leagues

GET /get_sports_and_leagues/
  • Success - 200

    • List of all sports

  • Failure

http.get(url + "get_sports_and_leagues.php").map()

get_teams_by_league

Get all teams from a league.

GET /get_teams_by_league/:league
  • league: The id of the league.

  • Success - 200

    • List of all teams for the league

  • Failure - 400

http.get(url + "get_teams_by_league.php", {
        params:{league: 1}}).map();

get_league_data_by_name

Get all league information from its name.

GET /get_league_data_by_name/:leaguename
  • leaguename: The name of the league.

  • Success - 200

    • All fields for the selected league

  • Failure - 400

last_event_id_by_date_and_league

Get the event id of the last event on a date and for the league.

GET /last_event_id_by_date_and_league/:date/:league
  • date: Event date in the format YYYY-MM_DD

  • league: The name of the league.

  • Success - 200

    • The last event id for league on date

  • Failure - 400

http.get(url + "last_event_id_by_date_and_league.php", {
        params:{
                date: "2020-02-29",
                league: 1}}).map();

last_event_id

Get the id of the last event.

GET /last_event_id/
  • Success - 200

    • The last event_id for all leagues

  • Failure - 400

http.get(url + "last_event_id.php").map()

last_game_id_by_date_and_league

Get the game id of the last game on a date and for the league.

GET /last_game_id_by_date_and_league/:date/:league
  • date: Game date in the format YYYY-MM_DD

  • league: The name of the league.

  • Success - 200

    • The last game id for league on date

  • Failure - 400

http.get(url + "last_game_id_by_date_and_league.php", {
        params:{
                date: "2020-02-29",
                league: 1}}).map();

last_game_id

Get the game id of the last game for all sports.

GET /last_game_id
  • Success - 200

    • The last game id for all sports.

  • Failure - 400

http.get(url + "last_game_id.php").map();

last_game

Get the game details of all games sorted descending so the most recent (last) game is the first record

GET /last_game
  • Success - 200

    • All game records sorted descending.

  • Failure - 400

http.get(url + "last_game").map();

run_replay

Run a data replay for the selected sport and league(s)

GET /run_replay/:sport/:leagues/:start/:end
  • sport: The name of the sport

  • leagues: The name of the leagues. Pipe separated list, e.g "EPL|La Liga|Serie A

  • start: Start date in the format YYYY-MM_DD

  • end: End date in the format YYYY-MM_DD

  • Success - 200

    • title: Replay completed

    • message: [sport]: { [league]: total, [league]: total, ... }

  • Failure - 400

http.get(url + "run_replay.php", {params:{
                sport: "Soccer", 
                leagues: "EPL | La Liga", 
                start: "2020-02-01", 
                end: "2020-01-08"}}).map();

Note: Replays can only be run for one sport at a time.

finish_game_message: Object of type

cancel_game_message: Object of type

create
Add Game Success Response
BOS Errors
Incident Errors
Add Game Errors
in_progress
Start Game Success Response
BOS Errors
General Errors
Start Game Errors
result
Add Score Success Response
BOS Errors
General Errors
Add Score Errors
finish
Finish game success response
BOS Errors
General Errors
Finish Game Errors
canceled
Cancel game success response
BOS Errors
General Errors
Cancel Game Errors
Error 430
Error 431
Error 432
Error 433
Error 434
Error 435
Error 436
Error 437
Error 438
Error 439
Error 446
Error 440
Error 441
Error 442
Error 443
Error 444
Error 445