Get started
API Endpoint https://api.cybfed.com/
The Cybfed API provides programmatic access to read and work with cybfed users and tournament events data.
To use this API, you need client_id and client_secret. For that you should registered in partner portal and
add application. After that you will see your client_id and client_secret
You will need to add redirect urls for validate url to which will be sent data after after successful login. You can add multiple url for validate them. For example localhost or your test server and live. Also you can add test users for test workflow before go live with your game in our platform.
You will need jwt lib for generate and work with our api. You should make token with client_id, sign with client_secret and put as bearer authorization.
jwt.sign(client_id, client_secret);
After having token you should put authorization header. Bearer: token
All data that platform will send to you will be signed with client_secret.
Login With Cybfed
To Login via cybfed you need to redirect login :
https://cybfed.com/auth/login?client_id={client_id}&redirectUrl={redirectUrl}
Response example : {redirectUrl}?
status=200&
message=Successfully%20logged%20in&
data=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbiI6ImV5SmhiR2NpT2lKSVV6STFOaUo5Lk5XWXdabVpsTURJMFpERm1ZVGMzWm1Rd1pHRmtOVEl5Lm03c2NpUUFVTlpRcWx5eFZUbVFodUI3WnlrdExOTzZRYU02aWZoNnh6a3MiLCJuaWNrbmFtZSI6InRlc3RAY3liZmVkLmNvbSIsImFjY291bnRfaWQiOiI1ZjBmZmUwMjRkMWZhNzdmZDBkYWQ1MjIiLCJpYXQiOjE1OTQ4ODg0NDJ9.BIUol48WzfwyJ04sqDe77OKSD_nEhAjalnPMk5CGx_s
QUERY PARAMETERS
Field | Type | Description |
---|---|---|
client_id | String | Your Client Id. |
redirectUrl | String | Where to redirect after success logging in. Need be added in redirect urls list in partners application panel |
Result decode
For decode results you should
jwt.verify(data,client_secret)
After decode this token you will have something like this.
{token: token, nickname: account.nickname, account_id: account._id, avatar: account.avatar}
Create room web hook
For create tournament you will need to add create_room_url in our platform for your application and create endpoint for receive POST request from cybfed for create a room.
In screenshot is shown where you should add "create room url"(applications->edit->For tournaments tab)
We send corresponding data to this endpoint via post request
{"event": { "name": "String", "id": "String", "players_count": "Integer", "event_type": "String" }, "teams": [ { "team_id": "String", "team_name": "String", "players": [ { "id": "String" } ] }, { "team_id": "String", "team_name": "String", "players": [ { "id": "String" } ] } ] }
curl --header "Content-Type: application/json" \
--header "Authorization: Bearer token" \
--request POST \
--data '{
"event": {
"name": "String",
"id": "String",
"players_count": "Integer",
"event_type": "String"
},
"teams": [
{
"team_id": "String",
"team_name": "String",
"players": [
{ "id": "String" }
]
},
{
"team_id": "String",
"team_name": "String",
"players": [
{ "id": "String" }
]
}
]
}' \
{{createRoomUrl}}
This request should create room in your game where opponents should be first team first player and second team first player. In current version we support only one to one games. If your game has more then 2 players in one room we will provide this functionality soon and let you know. Bee in touch. You should save event.id and team_id - s for letting cybfed know in feature what is result of the game.
If your game support deeplink for open room and start to play, this request should give response,- game room deeplink
{{ {deepLink: 'DEEPLINK_TO_ROOM'}|json }}
QUERY PARAMETERS
Field | Type | Description |
---|---|---|
data | JSON String | { "event": { "name": "String", "id": "String", "players_count": "Integer", "event_type": "String" }, "teams": [ { "team_id": "String", "team_name": "String", "players": [ { "id": "String" } ] }, { "team_id": "String", "team_name": "String", "players": [ { "id": "String" } ] } ] } |
Result
{status: 200, message: "Successfully created", deepLink: "DEEPLINK_TO_ROOM"}
Result
{
status: 200,
message: "Successfully created",
deepLink: "DEEPLINK_TO_ROOM"
}
Update Room Info
When players finished their game you should send post request to our endpoint api.cybfed.com/api/public/event/results for letting know who wins
{ "id": "5eff359d43d1a029b8093a84", "winnerTeamId": "5eff359d43d1a029b8093a85" }
curl --header "Content-Type: application/json" \
--header "Authorization: Bearer token" \
--request POST \
--data '{
"id": "5eff359d43d1a029b8093a84",
"winnerTeamId": "5eff359d43d1a029b8093a85"
}' \
https://api.cybfed.com/api/public/event/results
Result
{
status: 200,
message: "Successfully updated"
}
QUERY PARAMETERS
Field | Type | Description |
---|---|---|
data | JSON String | { "id": "5eff359d43d1a029b8093a84", "winnerTeamId": "5eff359d43d1a029b8093a85" } |
Result
{status: 200, message: "Successfully created"}