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

Last updated