Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

REST API

juan-castrillon edited this page Feb 12, 2021 · 1 revision

Node Registration

Register a node in the platform, based on the platforms definition.

URL

To be configured in a GenericPOST definition

Method:

POST

Data

  • Content-Type: application/json

  • Body: JSON object with the following fields:

    Field Type Example
    id String "node_1"
    ipAddress String "172.10.0.111:10800"
    connected boolean true

Response:

  • 200: Success
  • 500: Server Error, possible mistake in body

Sample Call:

curl -X POST http://localhost:4567/node/register -H 'content-type: application/json' -d '{
  "id": "node1",
  "ipAddress": 172.10.0.111,
  "connected": true
}'

For a configuration with inputs:

{"type": "MatchMaker-Random","name": $NAME},
{"type": "GenericPOST","name": $NAME,"address": "/node/register","port": 4567,
       "command" :  "register_node $body",
       "information": [],
       "@IOType" : "CustomCommand"
}

And outputs:

{"type": "MatchMaker-Random","name": $NAME}

Client Registration

Register a client in the platform , based on the platforms definition.

URL

To be configured in a GenericPOST definition

Method:

POST

Data

  • Content-Type: application/json

  • Body: JSON object with the following fields:

    Field Type Example
    id String "client_1"

Response:

  • 200: Success
  • 500: Server Error, possible mistake in body

Sample Call:

  curl -X POST http://localhost:4567/client/register -H 'content-type: application/json' -d '{
  "id" : "client1"
  }'

For a configuration with inputs:

{"type": "MatchMaker-Random","name": $NAME},
{"type": "GenericPOST","name": $NAME,"address": "/client/register","port": 4567,
       "command" :  "register_client $body",
       "information": [],
       "@IOType" : "CustomCommand"
}

And outputs:

{"type": "MatchMaker-Random","name": $NAME}

Client Assignment

Perform match-making on a given client (should be registered first)

URL

To be configured in a GenericPOST definition

Method:

POST

Data

  • Content-Type: application/json

  • Body: JSON object with the following fields:

    Field Type Example
    id String "client_1"

Response:

  • 200: Request send successfully (Not necessarily client assigned)

Sample Call:

curl -X POST http://localhost:4567/client/assign -H 'content-type: application/json' -d '{
  "id" : "client1"
  }'

For a configuration with inputs:

{"type": "MatchMaker-Random","name": $NAME},
{"type": "GenericPOST","name": $NAME,"address": "/client/assign","port": 4567,
       "command" :  "assign_client $id",
       "information": ["id"],
       "@IOType" : "CustomCommand"
     }

And outputs:

{"type": "MatchMaker-Random","name": $NAME}

Node Information Delivery

Fetch a resource containing connecting information about an assigned node for a given client

URL

To be configured in a GenericGET definition

Method:

GET

URL Params

Required:

client_id=[String] : ID of the client in which match-making was already performed (has an assigned node)

Response:

  • 200: Success, the client had an assigned node
    • Content: JSON containing the node information (Same schema as here)
  • 404: Not found, there is not a registered client with the given ID or it has not been assigned a node yet

Sample Call:

curl http://localhost:4567/client/get_node/client1

For a configuration with inputs:

{"type": "MatchMaker-Random","name": $NAME},
And outputs:
```json
{"type": "GenericGET","name": $NAME, "address": "/client/get_node/:client_id","port": 4567}
Clone this wiki locally