Interact with the Database

Creating and executing GraphQL operations on your database can be done in several ways. Below is a detailed guide for each method, to be included in Cedalio's documentation site:

Using the Explorer

  • Navigate to the databases list within the Studio.

  • Locate the row corresponding to the database you wish to query.

  • Click the second button in the row, which is designated for accessing the Explorer.

  • Within the Explorer, you can write and execute your GraphQL queries and mutations directly.

Using the SDK

  • Go to the SDK section within the documentation.

  • Follow the setup instructions to install the SDK in your development environment.

  • Utilize the provided methods in the SDK to construct and execute GraphQL operations.

  • The SDK will manage the connection and execution against your database, simplifying the process.

Using cURL

  • Ensure you have the correct API endpoint and authentication token for your database.

  • This method is suitable for quick tests or automation scripts.

curl -v "https://COMPANY_ID.gtw.cedalio.io/DATABASE_ID/graphql" 
-X POST -H "Content-Type: application/json" 
    -d "{ \"query\":\"mutation { 
            createPost(post: { 
                title: \\\"This is the post's title\\\", 
                content: \\\"This is the post's content, it's very interesting\\\"
            }){   
                id 
                title 
                content 
            } 
        }\"
    }"

Important Notes:

  • Ensure that you have the necessary permissions and an API key to authenticate your requests.

  • When running operations, especially mutations, be aware of the changes you are making to the database to prevent unintended data alterations.

  • Remember that all changes made to the database are stored in the blockchain, so we can keep track of all the changes made and who made them.

  • For security reasons, always keep your API keys and database credentials confidential.

Each method provides flexibility depending on your use case, whether you're performing quick lookups or integrating database operations into your application workflow. Detailed examples and additional guidelines are available in the SDK section to assist with more complex operations or troubleshooting.

Last updated