Diggama CMS Documentation

1. General Architecture

Diggama is a headless CMS that provides:

2. Blog Posts Management

Listing Articles

// Endpoint: GET https://api.diggama.com/v1/resources/articlequiversphere
// Required headers:
{
  'Accept': 'application/json',
  'Authorization': 'Bearer DIGGAMA_TOKEN'
}

// Response structure
interface Article {
    id: string;
    attributes: {
        headline: string;
        description: string;
        content: string;
        date: string;
        author: string;
        authorjob: string;
        category: string;
    }
}

Displaying an Article

Articles are individually accessible via their ID using the same endpoint. The system uses Astro for static page generation.

3. Forms Management

JavaScript Client

class DiggamaClient {
    constructor(token: string);
    
    // Forms handling
    form(
        form: HTMLFormElement,
        resource: string,
        onSuccess: () => void,
        onError: (error: any) => void
    ): void;
}

Supported Form Types

  1. Contact Form

    // Endpoint: POST https://api.diggama.com/v1/resources/contact
    interface ContactForm {
        firstname: string;
        lastname: string;
        company?: string;
        email: string;
        message: string;
    }
  2. Application Form

    // Endpoint: POST https://api.diggama.com/v1/resources/candidatures
    interface ApplicationForm {
        firstname: string;
        lastname: string;
        company: string;
        email: string;
        telephone: string;
        description: string;
        team: string;
        motivation: string;
    }

4. Authentication

API Token

Integration Script

<script 
    src="https://api.diggama.com/v1/here.js" 
    x-diggama-token="YOUR_TOKEN" 
    async
/>

5. Best Practices

  1. Security

  2. Performance

  3. Error Handling

6. Available API Endpoints

7. Frontend Integration

The CMS integrates seamlessly with:

8. Example Usage

Setting up the Client

import { DiggamaClient } from '@diggama/client';

const client = new DiggamaClient(process.env.DIGGAMA_TOKEN);

Handling Forms

// Contact form example
diggamaClient.form(
    document.getElementById('contact-form'),
    "contact",
    () => {
        alert("Thank you for your message");
        form.reset();
    },
    () => alert("An error occurred while sending your message. Please try again later.")
);

Fetching Articles

const response = await fetch('https://api.diggama.com/v1/resources/articlequiversphere', {
    headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer ' + process.env.DIGGAMA_TOKEN
    }
});
const articles = await response.json();

9. Environment Variables

Required environment variables for the CMS:

DIGGAMA_TOKEN=your_api_token

10. Support and Resources

For additional support or questions: