surrealpatch/docs/ENDPOINTS.md
2016-04-04 10:07:56 +01:00

1.6 KiB

Endpoints

This document describes RESTful http endpoints which can be used to query and manipulate the database.


SQL

The SQL endpoint allows you to query the database using any SQL query supported by Surreal. The content body must contain the properly formatted SQL queries which should be executed by the database. It may include a batch of SQL statements separated by a semicolon.

  • POST https://api.surreal.io/sql

Key Value

The key value endpoints allow you to manipulate the database records without needing to use SQL. It only includes a small portion of the functionality available with SQL queries. The endpoints enable you to use the database as if it were an API, using multi-tenancy separation, and multi-level authentication for preventing access to specific data within a database.

  • GET https://api.surreal.io/key/{table}
SELECT * FROM {table}
  • POST https://api.surreal.io/key/{table}
CREATE {table}
  • DELETE https://api.surreal.io/key/{table}
DELETE {table}
  • GET https://api.surreal.io/key/{table}/{key}
SELECT * FROM @{table}:{id}
  • PUT https://api.surreal.io/key/{table}/{key}
UPDATE @{table}:{id} CONTENT {} RETURN AFTER
  • POST https://api.surreal.io/key/{table}/{key}
CREATE @{table}:{id} CONTENT {} RETURN AFTER
  • PATCH https://api.surreal.io/key/{table}/{key}
MODIFY @{table}:{id} DIFF {} RETURN AFTER
  • TRACE https://api.surreal.io/key/{table}/{key}
SELECT HISTORY FROM @{table}:{id}
  • DELETE https://api.surreal.io/key/{table}/{key}
DELETE @{table}:{id}