Quickstart
This section provides step-by-step instructions on how to perform basic CRUD operations (create, read, update and delete) using Morph's API. Through this tutorial, you can easily start working with Morph's database.
In this example, the API is invoked using the cURL command, so try it out by pasting the command into your terminal environment or an API client tool such as Postman.
API Calls
Replace
[Your_DatabaseID]
,[Your_Table_Slug]
, and[Your_API_Key]
with your own values!
Create
To create new data, use the POST method.
curl --location --request POST 'https://beta-api.morphdb.io/v0/rest/[Your_DatabaseID]/[Your_Table_Slug]' \
--header 'x-api-key: [Your_API_Key]' \
--header 'Content-Type: application/json' \
--data-raw '{
"column1": "value1",
"column2": "value2"
}'
Read
Use the GET method to read data from a table.
curl --location 'https://beta-api.morphdb.io/v0/rest/[Your_DatabaseID]/[Your_Table_Slug]' \
--header 'x-api-key: [Your_API_Key]'
Update
Use the PUT method to update existing data.
curl --location --request PUT 'https://beta-api.morphdb.io/v0/rest/[Your_DatabaseID]/[Your_Table_Slug]' \
--header 'x-api-key: [Your_API_Key]' \
--header 'Content-Type: application/json' \
--data-raw '{
"column1": "new_value1"
}'
Delete
Use the DELETE method to delete data.
curl --location --request DELETE 'https://beta-api.morphdb.io/v0/rest/[Your_DatabaseID]/[Your_Table_Slug]' \
--header 'x-api-key: [Your_API_Key]' \
--header 'Content-Type: application/json' \
--data-raw '{
"column1": "value_to_delete"
}'
Reference
In addition to these, PostgREST allows various query patterns to be realized for customer applications. For more information, please see the following reference documents.