Database APIs
Last updated
Was this helpful?
Last updated
Was this helpful?
GraphQL always uses the POST method and the same endpoint to make requests. Here, we are going to imagine we have a products table under a project, and we are going to create, read, update, and delete a product from this table using GraphQL.
The endpoint URL is as follows:
https://YOUR_PROJECT_ID.api.deskree.com/api/v1/graphql
You can access the GraphQL schema for your project in:
API Docs web viewer
Downloading from the API Docs page
Note that the Users table is a special table and does not allow Creation or Deletion directly via GraphQL requests since account creation/removal is handled by . For more information, view our Users Table guide.
The body query to get a list of products, including all of the objects' properties is as follows:
And the body response to the request above is:
The beauty of GraphQL is that you can fetch only the necessary information just by changing the query structure. Here's another example of how to fetch a single product by UID, and this time let's just fetch the name and price properties of it:
And the result for this new request is:
Now, let's create a product, and return this product's uid, name, and price. To do so, we can have a body mutation as follows:
And the result of our request is:
Now, let's update the previous product price, and return the product's uid, name, and price. To modify a product, we need to specify which product to update, and the new value we want to set. To do so, we can have a body mutation as follows:
And the result of our request is:
To delete a product, we just need to specify the uid of the object within the following mutation:
And your body response will be: