graviton-cloud-api-docs

Graviton Cloud API Documentation

Overview

This documentation provides information about the Graviton Cloud RESTful Object Database HTTP API endpoints.

Table of Contents

  1. GET /api/v1/object
  2. PUT /api/v1/object
  3. POST /api/v1/object
  4. DELETE /api/v1/object

1. GET /api/v1/object

Retrieve an object based on the specified path.

Request

Headers

Parameters

Response

Success (200 OK)

Returns the object at the specified path.

{
    "status": "success",
    "data": {
        // ... object data
    }
}

Errors

{
    "status": "error",
    "message": "Missing or invalid path parameter."
}
{
    "status": "error",
    "message": "Unauthorized. Please provide a valid API key."
}
{
    "status": "error",
    "message": "Object not found."
}

Example Requests

Using cURL:

curl -X GET "https://api.gravitoncloud.com/api/v1/object?path=/path/to/object" \
     -H "x-api-key: your-uuid-formatted-api-key"

Using Node.js with Axios:

First, ensure you have axios installed:

npm install axios

Then, use the following script:

const axios = require('axios');

// Define the base URL and endpoint
const BASE_URL = 'https://api.gravitoncloud.com';
const ENDPOINT = '/api/v1/object';

// Define your query parameter and API key
const path = '/path/to/object';
const API_KEY = 'your-uuid-formatted-api-key'; // Replace with your actual API key

// Make the GET request
axios.get(`${BASE_URL}${ENDPOINT}`, {
    params: {
        path: path
    },
    headers: {
        'x-api-key': API_KEY
    }
})
.then(response => {
    console.log('Success:', response.data);
})
.catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
});

Notes


2. PUT /api/v1/object

Update or create an object at the specified path.

Request

Headers
Parameters
Body

Response

Success (200 OK or 201 Created)

If the object is updated:

{
    "status": "success",
    "message": "Object updated successfully."
}

If a new object is created:

{
    "status": "success",
    "message": "Object created successfully."
}

Errors

{
    "status": "error",
    "message": "Missing or invalid data."
}
{
    "status": "error",
    "message": "Unauthorized. Please provide a valid API key."
}

Example Requests

Using cURL:

curl -X PUT "https://api.gravitoncloud.com/api/v1/object?path=/path/to/object" \
     -H "x-api-key: your-uuid-formatted-api-key" \
     -H "Content-Type: application/json" \
     -d '{
         "field1": "value1",
         "field2": "value2"
         // ... other fields ...
     }'

Using Node.js with Axios:

Ensure you have axios installed:

npm install axios

Then, use the following script:

const axios = require('axios');

// Define the base URL, endpoint, query parameter, API key, and payload
const BASE_URL = 'https://api.gravitoncloud.com';
const ENDPOINT = '/api/v1/object';
const path = '/path/to/object';
const API_KEY = 'your-uuid-formatted-api-key'; // Replace with your actual API key
const payload = {
    field1: 'value1',
    field2: 'value2'
    // ... other fields ...
};

// Make the PUT request
axios.put(`${BASE_URL}${ENDPOINT}`, payload, {
    params: {
        path: path
    },
    headers: {
        'x-api-key': API_KEY
    }
})
.then(response => {
    console.log('Success:', response.data);
})
.catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
});

Notes


3. POST /api/v1/object

Create a new object at the specified path. If an object already exists at the specified path, the request will fail.

Request

Headers

Parameters

Body

Response

Success (201 Created)

The object was successfully created.

{
    "status": "success",
    "message": "Object created successfully."
}

Errors

{
    "status": "error",
    "message": "Missing or invalid data."
}
{
    "status": "error",
    "message": "Unauthorized. Please provide a valid API key."
}
{
    "status": "error",
    "message": "Conflict. Object already exists at the specified path."
}

Example Requests

Using cURL:

curl -X POST "https://api.gravitoncloud.com/api/v1/object?path=/path/to/object" \
     -H "x-api-key: your-uuid-formatted-api-key" \
     -H "Content-Type: application/json" \
     -d '{
         "field1": "value1",
         "field2": "value2"
         // ... other fields ...
     }'

Using Node.js with Axios:

Ensure you have axios installed:

npm install axios

Then, use the following script:

const axios = require('axios');

// Define the base URL, endpoint, query parameter, API key, and payload
const BASE_URL = 'https://api.gravitoncloud.com';
const ENDPOINT = '/api/v1/object';
const path = '/path/to/object';
const API_KEY = 'your-uuid-formatted-api-key'; // Replace with your actual API key
const payload = {
    field1: 'value1',
    field2: 'value2'
    // ... other fields ...
};

// Make the POST request
axios.post(`${BASE_URL}${ENDPOINT}`, payload, {
    params: {
        path: path
    },
    headers: {
        'x-api-key': API_KEY
    }
})
.then(response => {
    console.log('Success:', response.data);
})
.catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
});

Notes


4. DELETE /api/v1/object

Delete an object at the specified path.

Request

Headers

Parameters

Response

Success (200 OK)

The object was successfully deleted.

{
    "status": "success",
    "message": "Object deleted successfully."
}

Errors

{
    "status": "error",
    "message": "Missing or invalid path."
}
{
    "status": "error",
    "message": "Unauthorized. Please provide a valid API key."
}
{
    "status": "error",
    "message": "Object not found."
}

Example Requests

Using cURL:

curl -X DELETE "https://api.gravitoncloud.com/api/v1/object?path=/path/to/object" \
     -H "x-api-key: your-uuid-formatted-api-key"

Using Node.js with Axios:

Ensure you have axios installed:

npm install axios

Then, use the following script:

const axios = require('axios');

// Define the base URL, endpoint, and query parameter
const BASE_URL = 'https://api.gravitoncloud.com';
const ENDPOINT = '/api/v1/object';
const path = '/path/to/object';
const API_KEY = 'your-uuid-formatted-api-key'; // Replace with your actual API key

// Make the DELETE request
axios.delete(`${BASE_URL}${ENDPOINT}`, {
    params: {
        path: path
    },
    headers: {
        'x-api-key': API_KEY
    }
})
.then(response => {
    console.log('Success:', response.data);
})
.catch(error => {
    console.error('Error:', error.response ? error.response.data : error.message);
});

Notes