Giter VIP home page Giter VIP logo

x1jogos-api's Introduction

x1jogos-api

X1 Games - API Documentation

Introduction

This documentation details the endpoints available on the X1Jogos API.

Auth

Authentication is done through an API Key that will be sent to the developer. It must be transmitted in all requests in the Photon-Secret header. If the API Key is invalid or not informed, X1 Jogos will return HTTP 401.

HTTP Responses codes

X1 Jogos uses conventional HTTP responses to indicate success or failure in requests. Responses with status 200 indicate success, status 4xx indicate failures due to errors in the information sent and status 500 indicate internal errors on the X1 Jogos server.

HTTP Code Description
200 Ok Your request was successful
400 Bad Request Some mandatory parameter was not sent or is invalid. In this case the answer itself will indicate what the problem is.
401 Unauthorized API Key not sent or invalid
429 Too Many Requests Too many orders in a given period of time.
500 Internal Server Error Something went wrong on the X1 Games server

All X1 Games API endpoints receive and respond in JSON.

Example response for HTTP 400:

{
    "code": 400,
    "message": {
        "error": "Insufficient balance"
    },
    "player": {
        "token": "3947208fj23j203874",
        "user_id": "1",
        "account_id": "2",
        "balance_used": "balance"
    }
}

POST - Create Match

/webhook/x1/create_match

Create a new match

Enables the creation of a new match. In order to be able to create a match, it is first necessary to collect the information of all the users and accounts of the players that will be in the game through a specific cookie so that this information is passed to the endpoints.

All attributes of this endpoint are necessary for the Match to be created, except the room_bet_value which, if not sent, will be considered 0 by default.

In the players field, there can be any number of players desired, as long as they all have the required fields.

The HTTP code will be returned, an error or success message, depending on the result of the request, and, if the request has failed, it will also return the data of the player that does not comply with the request, if the request is successful, the match identifier will be returned, which can be used in other API endpoints.

Body

{
    "room_bet_value": int,
    "game_code": string,
    "players": [
        {
            "token": string,
            "user_id": string,
            "account_id": string,
            "balance_used": enum ("balance"|"balanceBonus")
        }
    ]
}
Example
Request
{
    "room_bet_value": 50,
    "game_code": "palitinho",
    "players": [
        {
            "token": "472307f23hf3",
            "user_id": "1",
            "account_id": "2",
            "balance_used": "balance"
        },
        {
            "token": "0rjsdof238",
            "user_id": "45",
            "account_id": "90",
            "balance_used": "balanceBonus"
        }
    ]
}
Response
{
    "code": 400,
    "message": {
        "success": "Match created sucessfully"
    },
    "data": {
        "match_id": 45
    }
}

POST - End Match

/webhook/x1/end_match

Finish a match

When an ongoing match ends, only the match identifier and the account identifier that won that match will be passed to this endpoint. If the match is not in progress or does not exist, an HTTP 400 code will be returned, if the match is successfully completed, an HTTP 200 code will be returned with a success message.

Body

{
    "match_id": string,
    "winner_id": string
}
Example
Request
{
    "match_id": "4",
    "winner_id": "90"
}
Response
{
    "code": 200,
    "message": {
        "success": "Match finished successfully"
    }
}

GET - Get player balance

/webhook/x1/get_player_balance

Show player balance

Show all balances of the player who owns the identifier passed in the request. If the player is not found, an HTTP 400 code is returned.

Body

{
    "user_id": string,
    "account_id": string
}
Example
Request
{
    "user_id": "45",
    "account_id": "90"
}
Response
{
    "code": 200,
    "message": {
        "success": "Account balance retrieved successfully"
    },
    "data": {
        "account_balance": "",
        "account_balanceBonus": ""
    }
}

GET - Get player avatar

/webhook/x1/get_player_avatar

Retrieve the player's avatar

Retrieves the avatar of a specific account, this avatar will be base64 encoded. If the account is not found, an HTTP 400 code will be returned. If the account does not have an avatar, an HTTP 200 code will be returned, but with the account_avatar_base64 = null field.

Body

{
    "user_id": string,
    "account_id": string
}
Example
Request
{
    "user_id": "45",
    "account_id": "90"
}
Response
{
    "code": 200,
    "message": {
        "success": "Player avatar retrieved successfully"
    },
    "data": {
        "account_avatar_base64": ""
    }
}

GET - Get account pending match

/webhook/x1/get_account_pending_match

Retrieves the match the account is in

It retrieves the match_id of a pending match that the last account is in, if the account is not found, an HTTP 400 code will be returned. If the account is not in any pending match, an HTTP 200 code will be returned, but the field match_id = null.

Body

{
    "user_id": string,
    "account_id": string
}
Example
Request
{
    "user_id": "45",
    "account_id": "90"
}
Response
{
    "code": 200,
    "message": {
        "success": "Pending match retrieved successfully"
    },
    "data": {
        "match_id": "5"
    }
}

x1jogos-api's People

Contributors

connectblackofficial avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.