Rocket Networking Docs🚀
  • About this Documentation
  • Basics of Rocket Networking
    • Room based multiplayer (Auto State Sharing)
      • Clients and clientId
      • Entities
      • Smart Entities
    • Single Message Sharing
    • Persistent Objects on the Server
    • Easy Matchmaking
    • Discord Server Integration
    • Database for your Account
    • Server Side Scripting
    • Global Multiplayer(Cross play)
  • Rocket Networking Code
    • Connecting and Disconnecting
      • ConnectToServer()
      • callback_ConnectToServer()
      • DisconnectFromServer()
      • callback_DisconnectFromServer()
    • Rooms
      • ChangeRoom( new_room_name )
      • callback_ChangeRoom()
      • LeaveRoom()
      • callback_LeaveRoom()
      • ShowAllClientsInRoom(room_name ) and callback_ShowAllClientsInRoom()
      • ShowAllRooms() and callback_ShowAllRooms()
    • Private Messaging
      • SendEventToClient
      • callback_ReceivedEvent
      • SendMessageToClient
      • callback_ReceivedMessage
    • Persistent Objects
      • CreatePersistentObject(roomId , persistentObjectStruct)
      • callback_CreatedPersistentObject()
      • EditPersistentObject(persistentObjectId , new_persistentObjectStruct)
      • DestroyPersistentObject(persistentObjectId)
      • ShowPersistentObjectsInRoom(room_name)
      • callback_ShowAllPersistentObjectsInRoom(array_of_persistent_objects)
    • Database Functions
      • SetSimpleData()
      • callback_SetSimpleData()
      • ReadSimpleData()
      • callback_ReadSimpleData()
      • AddToSimpleData()
      • callback_AddToSimpleData()
      • DeleteSimpleData()
    • Discord Integration
      • SendDiscordMessage()
      • callback_DiscordMessageReceived()
    • AI Functions
      • CallSimpleAI
      • callback_CallSimpleAI
      • CallGeneralAI
      • callback_CallGeneralAI
  • KickPlayer(client_id)
  • ViewServerActivity()
    • callback_ViewServerActivity()
  • oBrain - ping and pseudoHost
  • Admin Callbacks
  • API
    • Database
    • AI
  • Server Side Scripting
    • Basics
    • Understand the heirarchy on the server
    • Create a Persistent Object from Server
    • Important Scripts
      • "step" Script format
      • "client_sent_event" Script format
      • "game_server_created" Script format
    • Send Event to a Client from Server
    • Database Functions on Server
    • AI Functions on the Server
Powered by GitBook
On this page
  • Introduction
  • Authentication
  • Endpoints
  • Retrieve Document (GET)
  • Create or Overwrite Document (POST)
  • Append Document (PATCH)
  • Delete Document (DELETE)
  • Example Usage
  1. API

Database

Introduction

The Rocket Networking API allows users to interact with their database, which is backed by Firebase Firestore. To access the API, use the following base URL:

https://apps.rocketnetworking.net/api

Authentication

For authentication, include your serverId in the Authorization header for all requests. No additional authentication parameters, such as Bearer tokens, are required.

Example

GET /database/:collection/:document
Authorization: YOUR_SERVER_ID

Endpoints

Retrieve Document (GET)

Retrieve a document from the specified collection and document ID.

Request

GET /database/:collection/:document
Authorization: YOUR_SERVER_ID

Response

The API will return the requested document in the response body and 200 status code.

Create or Overwrite Document (POST)

Create or overwrite a document in the specified collection. Include the data to be stored in the request body.

They request body is key for key replicated in the document fields.

Request

POST /database/:collection/:document
Authorization: YOUR_SERVER_ID
Content-Type: application/json

{
  "x": "value_x",
  "y": "value_y"
}

Response

The API will return 201 success code.

Append Document (PATCH)

Patch a document in the specified collection. Include the data to be patched in the request body.

This takes the keys which are not there in the original document and adds them, and for the keys which are there in the document on the database, it overwrites the values with the value you provided in the request body

They request body is key for key replicated in the document fields.

Request

PATCH /database/:collection/:document
Authorization: YOUR_SERVER_ID
Content-Type: application/json

{
  "x": "value_x",
  "y": "value_y"
}

Response

The API will return 201 success code.

Delete Document (DELETE)

Delete a document from the specified collection.

Request

DELETE /database/:collection/:document
Authorization: YOUR_SERVER_ID

Response

The API will return a status 204 for successful deletion.

Example Usage

Retrieve Document

GET /database/users/johndoe
Authorization: YOUR_SERVER_ID

Create or Overwrite Document

POST /database/users/johndoe
Authorization: YOUR_SERVER_ID
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com"
}

Patch Document

Patch/database/users/johndoe
Authorization: YOUR_SERVER_ID
Content-Type: application/json

{
  "age" : 34
}

Delete Document

DELETE /database/users/johndoe
Authorization: YOUR_SERVER_ID

PreviousAdmin CallbacksNextAI

Last updated 1 year ago