Skip to main content

User Dictionary API

Base path: /dictionaries

Types

// ============ Enums ============

type SoundLanguage = 'ar' | 'fr';

// ============ Request Types ============

interface CreateDictionaryRequest {
  name: string;                 // max 256 characters
  description?: string;
  language: SoundLanguage;
}

interface AddEntryRequest {
  file: File;                   // multipart/form-data (audio file)
  key: string;                  // max 256 characters (e.g., "100", "and", "thousand")
}

// ============ Response Types ============

interface DictionaryResponse {
  id: string;
  name: string;
  description: string | null;
  language: SoundLanguage;
  organizationId: string | null; // null for system dictionaries
  isSystem: boolean;
  createdAt: string;            // ISO date
  updatedAt: string;            // ISO date
  deletedAt: string | null;     // ISO date (soft delete)
  createdBy: string | null;     // User UUID
  updatedBy: string | null;     // User UUID
  deletedBy: string | null;     // User UUID
}

interface DictionaryEntryResponse {
  id: string;
  dictionaryId: string;
  key: string;
  audioId: string;
  createdAt: string;            // ISO date
  updatedAt: string;            // ISO date
  deletedAt: string | null;     // ISO date (soft delete)
  createdBy: string | null;     // User UUID
  updatedBy: string | null;     // User UUID
  deletedBy: string | null;     // User UUID
}

interface MessageResponse {
  message: string;
}

Endpoints

Create a dictionary

curl -X POST https://api.gomobile.ma/api/dictionaries \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
{
  "name": "Arabic Numbers",
  "description": "Arabic number pronunciations",
  "language": "ar"
}
'
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Arabic Numbers",
  "description": "Arabic number pronunciations",
  "language": "ar",
  "organizationId": "660e8400-e29b-41d4-a716-446655440001",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:30:00.000Z"
}

Get all dictionaries

curl -X GET https://api.gomobile.ma/api/dictionaries \
  -H "x-api-key: YOUR_API_KEY"
Response:
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Arabic Numbers",
    "description": "Arabic number pronunciations",
    "language": "ar",
    "organizationId": "660e8400-e29b-41d4-a716-446655440001",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z"
  }
]

Get a dictionary by ID


Delete a dictionary


Add an entry to a dictionary

// Request
POST /dictionaries/550e8400-e29b-41d4-a716-446655440000/entries
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: multipart/form-data

file: [binary audio file]
key: "100"

// Response 201
{
  "id": "770e8400-e29b-41d4-a716-446655440002",
  "dictionaryId": "550e8400-e29b-41d4-a716-446655440000",
  "key": "100",
  "audioId": "880e8400-e29b-41d4-a716-446655440003",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:30:00.000Z"
}

Get a dictionary entry by key

curl -X GET https://api.gomobile.ma/api/dictionaries/550e8400-e29b-41d4-a716-446655440000/entries/100 \
  -H "x-api-key: YOUR_API_KEY"
Response:
{
  "id": "770e8400-e29b-41d4-a716-446655440002",
  "dictionaryId": "550e8400-e29b-41d4-a716-446655440000",
  "key": "100",
  "audioId": "880e8400-e29b-41d4-a716-446655440003",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:30:00.000Z"
}

Remove an entry from a dictionary