NAV
bash javascript java

Introduction

Welcome to the Bead Roads API! You can use our API to access Bead Roads API endpoints, which can get information on various live streaming video url and bead result in our database.

You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

Bead Roads uses API keys to allow access to the API. You can register a new Bead Roads API key by contacting the developer.

Bead Roads expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer buBUA+cG7mgXSDmHDHD04foD1SrKbO22sC5AtYu.

Requesting Tokens

To get your API key, you must provide the correct user credentials as your parameter to get your access token. By default, Bead Roads API issues long-lived access tokens that never need to be refreshed.

Example request:

curl -X GET "http://128.199.103.196/public/oauth/token" \
-H "Accept: application/json"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "http://128.199.103.196/public/oauth/token",
    "method": "GET",
    "headers": {
        "accept": "application/json"
    }
}
URL obj = new URL("http://128.199.103.196/public/oauth/token");
HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();

//add request header
con.setRequestMethod("POST");

//set parameters
String urlParameters = "grant_type=password&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&username=YOUR_USERNAME&password=YOUR_PASSWORD&scope=*";

//send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();

int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);

BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();

//print result
System.out.println(response.toString());

Example response:

{
  "token_type": "Bearer",
  "expires_in": 31536000,
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjYwMGVhYjU1NDRiMGFkYjg3ZjQwNDY4MzdhNDc1MDRhN2",
  "refresh_token": "buBUA+cG7mgXSDmHDHD04foD1SrKbO22sC5AtYuvCxCL3qmTeF4AjUwkVawy9hU7ovUeAgIvE9284X+LqjSj2afex"
}

Query Parameters

Parameter Default Description
grant_type password Use for Password Grant Client
client_id To be provided by the API Developer
client_secret To be provided by the API Developer
username To be provided by the API Developer
password To be provided by the API Developer
scope * Asterisk by default means all scopes are included

Merchant

This resource will return the list of available merchants.

Get All Merchant

This endpoint retrieves all active merchants to be displayed on your home page.

Example request:

curl -X GET "http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/merchant" \
-H "Accept: application/json"
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
curl -X GET "http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/merchant" \
-H "Accept: application/json"
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/merchant",
    "method": "GET",
    "headers": {
        "accept": "application/json",
        "authorization" : "Bearer YOUR_ACCESS_TOKEN"
    }
}
URL obj = new URL("http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/merchant");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();

// optional default is GET
con.setRequestMethod("GET");

//add authorization
con.setRequestProperty("Authorization", "Bearer YOUR_ACCESS_TOKEN");

int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);

BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();

//print result
System.out.println(response.toString());

Example response:

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "OG2222",
      "status": "ACTIVE",
      "created_at": "2017-06-06 10:50:00",
      "updated_at": "2017-06-06 10:50:00"
    },
    {
      "id": 2,
      "name": "COD",
      "status": "ACTIVE",
      "created_at": "2017-06-06 10:50:00",
      "updated_at": "2017-06-06 10:50:00"
    },
    {
      "id": 3,
      "name": "CAGAYAN",
      "status": "ACTIVE",
      "created_at": "2017-06-06 10:50:00",
      "updated_at": "2017-06-06 10:50:00"
    }
  ]
}

HTTP Request

GET api/v1/merchant

HEAD api/v1/merchant

Match

This resource includes the overall data of match per table. Also includes the room name, room no, video url, bead roads and etc.

Get All Match

This endpoint retrieves all matches including the player bet result. Call this method every 2 seconds to get the latest data per table and to make your result in real time.

Example request:

curl -X GET "http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/match" \
-H "Accept: application/json"
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/match",
    "method": "GET",
    "headers": {
        "accept": "application/json",
        "authorization" : "Bearer YOUR_ACCESS_TOKEN"
    }
}
URL obj = new URL("http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/match");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();

// optional default is GET
con.setRequestMethod("GET");

//add authorization
con.setRequestProperty("Authorization", "Bearer YOUR_ACCESS_TOKEN");

int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);

BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();

//print result
System.out.println(response.toString());

Example response:

{
  "success": true,
  "data": [
    {
      "id": 1,
      "merchant_id": 1,
      "room_name": "M-1",
      "room_no": 1,
      "shoe_count": "17-3",
      "min_bet": "5,000",
      "max_bet": "500,000",
      "min_tie": "500",
      "max_tie": "62,500",
      "min_pair": "500",
      "max_pair": "45,000",
      "timer": 0,
      "video_url": "rtmp:\/\/beadsapi.com\/live\/table1",
      "created_at": "2017-06-06 10:50:23",
      "updated_at": "2017-06-07 10:23:02",
      "bead_road": {
        "match_id": 1,
        "bead": "aakieeebbecagaaaaeaeigaieaiaaaeieaaaaeega"
      }
    },
    {
      "id": 2,
      "merchant_id": 1,
      "room_name": "M-2",
      "room_no": 2,
      "shoe_count": "9-49",
      "min_bet": "5,000",
      "max_bet": "500,000",
      "min_tie": "500",
      "max_tie": "62,500",
      "min_pair": "500",
      "max_pair": "45,000",
      "timer": 0,
      "video_url": "rtmp:\/\/beadsapi.com\/live\/table2",
      "created_at": "2017-06-06 10:50:23",
      "updated_at": "2017-06-06 10:55:03",
      "bead_road": {
        "match_id": 2,
        "bead": "aagegeeeceeaeaaaabeaeeegaaceaieeikaaiaiiaaaaieaaaaa"
      }
    }
}

HTTP Request

GET api/v1/match

HEAD api/v1/match

Beads Image

The Bead Roads API guidlines for displaying the bead image

Code Image
a
b
c
d
e
f
g
h
i
j
k
l

Get By Merchant Id

This endpoint retrieves specific data matches of merchant. Call this method every 2 seconds to get the latest data per table and to make your result in real time.

Example request:

curl -X GET "http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/match/1" \
-H "Accept: application/json"
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/match/1",
    "method": "GET",
    "headers": {
        "accept": "application/json",
        "authorization" : "Bearer YOUR_ACCESS_TOKEN"
    }
}
URL obj = new URL("http://128.199.103.196/group11.beadroadsapi.com/public/api/v1/match/1");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();

// optional default is GET
con.setRequestMethod("GET");

//add authorization
con.setRequestProperty("Authorization", "Bearer YOUR_ACCESS_TOKEN");

int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);

BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();

//print result
System.out.println(response.toString());

Example response:

{
  "success": true,
  "data": [
    {
      "id": 1,
      "merchant_id": 1,
      "room_name": "M-1",
      "room_no": 1,
      "shoe_count": "17-3",
      "min_bet": "5,000",
      "max_bet": "500,000",
      "min_tie": "500",
      "max_tie": "62,500",
      "min_pair": "500",
      "max_pair": "45,000",
      "timer": 0,
      "video_url": "rtmp:\/\/beadsapi.com\/live\/table1",
      "created_at": "2017-06-06 10:50:23",
      "updated_at": "2017-06-07 10:23:02",
      "bead_road": {
        "match_id": 1,
        "bead": "aakieeebbecagaaaaeaeigaieaiaaaeieaaaaeega"
      }
    },
    {
      "id": 2,
      "merchant_id": 1,
      "room_name": "M-2",
      "room_no": 2,
      "shoe_count": "9-49",
      "min_bet": "5,000",
      "max_bet": "500,000",
      "min_tie": "500",
      "max_tie": "62,500",
      "min_pair": "500",
      "max_pair": "45,000",
      "timer": 0,
      "video_url": "rtmp:\/\/beadsapi.com\/live\/table2",
      "created_at": "2017-06-06 10:50:23",
      "updated_at": "2017-06-06 10:55:03",
      "bead_road": {
        "match_id": 2,
        "bead": "aagegeeeceeaeaaaabeaeeegaaceaieeikaaiaiiaaaaieaaaaa"
      }
    }
}

HTTP Request

GET api/v1/match/{merchant_id}

HEAD api/v1/match/{merchant_id}

Beads Image

The Bead Roads API guidlines for displaying the bead image

Code Image
a
b
c
d
e
f
g
h
i
j
k
l

Errors

The Bead Roads API uses the following error codes:

Error Code Meaning
400 Bad Request – Your request sucks
401 Unauthorized – Your API key is wrong
403 Forbidden – The Bead Roads requested is hidden for administrators only
404 Not Found – The specified Bead Roads could not be found
405 Method Not Allowed – You tried to access a Bead Roads with an invalid method
406 Not Acceptable – You requested a format that isn’t json
410 Gone – The Bead Roads requested has been removed from our servers
429 Too Many Requests – You’re requesting too many kittens! Slow down!
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarially offline for maintanance. Please try again later.