Skip to content

Latest commit

 

History

History
116 lines (66 loc) · 3.1 KB

API.md

File metadata and controls

116 lines (66 loc) · 3.1 KB

GET /validate

The validation endpoint is used to validate the requesting client.

Parameters:

No parameters expected in the query string.

Websocket Message Body:

The following parameters should be sent via a WebSocket message after the connection has been established.

  • SALT: (Optional) A unique string that acts as a salt for the hash function. If not provided, a random hash will be generated by the server.
  • CID: The unique identifier for the client.
  • Name: The name of the client.

Responses:

  • If successful, it sends a WebSocket message containing the validation status, name, and elapsed time to the client.
  • If an error occurs, the connection will be closed without a response message.

2. GET /messaging

Messaging endpoint used to handle WebSocket messaging between connected clients.

Parameters:

No parameters expected in the query string.

Websocket Message Body:

  • User: The unique identifier of the user.

Responses:

  • If successful, it initiates a messaging channel between clients.
  • If an error occurs, the connection will be closed.

3. POST /shutdown

This endpoint is used to shut down the server.

Parameters:

No parameters expected in the request body.

Responses:

  • If successful, a 200 OK HTTP response will be sent with a message indicating the server is shutting down.

4. GET /getstats

This endpoint is used to get statistics about the server, such as sync status, node type, peer count, etc.

Parameters:

No parameters expected in the query string.

Responses:

  • If successful, it sends a WebSocket message containing the stats to the client.

5. POST /write

This endpoint is used to write data to the database.

Parameters:

  • key: The key to write to the database.
  • value: The value to be associated with the key.

Responses:

  • If successful, a 200 OK HTTP response will be sent with a message indicating the data was saved successfully.

6. GET /read

This endpoint is used to read data from the database.

Parameters:

  • key: The key to read from the database.

Responses:

  • If successful, a 200 OK HTTP response will be sent with the value associated with the key.

7. GET /update

This endpoint is used to update a key-value pair in the database.

Parameters:

  • key: The key to update in the database.
  • value: The new value to be associated with the key.

Responses:

  • If successful, a 200 OK HTTP response will be sent with a message indicating the data was updated successfully.

8. GET /delete

This endpoint is used to delete a key-value pair from the database.

Parameters:

  • key: The key to delete from the database.

Responses:

  • If successful, a 200 OK HTTP response will be sent with a message indicating the data was deleted successfully.

9. GET /get-ip

This endpoint is used to get the IP address of a domain.

Parameters:

  • domain: The domain to lookup the IP for.

Responses:

  • If successful, a 200 OK HTTP response will be sent with the IP address of the domain.
  • If an error occurs, a 500 Internal Server Error HTTP response will be sent with an error message.