### Error Handling Source: https://docs.decc0s.com/getting-started Details on how the API returns errors and common error types. ```APIDOC ### Error Handling When an error occurs, the API returns an error object with a message and extensions containing an error code. #### Response Example (Error) ```json { "errors": [ { "message": "Item not found", "extensions": { "code": "NOT_FOUND" } } ] } ``` #### Common Errors - **404 Not Found**: The requested resource does not exist. - **400 Bad Request**: Invalid query parameters or filter syntax. - **403 Forbidden**: Access denied (if authentication is required). ``` -------------------------------- ### Fetch Codex Items Source: https://docs.decc0s.com/getting-started Retrieves a list of all codex items available through the API. ```APIDOC ## GET /items/codex ### Description Retrieves a list of all codex items. ### Method GET ### Endpoint `https://api.decc0s.com/items/codex` ### Parameters #### Query Parameters - **filter** (object) - Optional - Allows filtering of results using Directus filter syntax. - **fields** (string) - Optional - Specifies which fields to include in the response. - **meta** (string) - Optional - Requests metadata to be included in the response. ### Request Example ```bash curl "https://api.decc0s.com/items/codex" ``` ### Response #### Success Response (200) - **data** (array) - An array of codex item objects. - **meta** (object) - Optional metadata about the response. #### Response Example ```json { "data": [ { "id": 1, "name": "Korka", "ancestor": "Slovenian king", "description": "A contemplative curator..." } ] } ``` ``` -------------------------------- ### Example Success Response Structure Source: https://docs.decc0s.com/getting-started Illustrates the standard JSON structure for successful responses from the MOCA Codex API. It includes a 'data' field for the requested information and an optional 'meta' field. ```json { "data": [ { "id": 1, "name": "Korka", "ancestor": "Slovenian king", "description": "A contemplative curator..." } ] } ``` -------------------------------- ### Basic Pagination with GET Requests Source: https://docs.decc0s.com/query-guide Demonstrates how to paginate through API results using the 'limit' and 'offset' query parameters. Each request retrieves a specific chunk of data. ```HTTP GET /items/codex?limit=10&offset=0 GET /items/codex?limit=10&offset=10 GET /items/codex?limit=10&offset=20 ``` -------------------------------- ### Pagination Examples Source: https://context7_llms Demonstrates how to paginate through API results by adjusting the 'limit' and 'offset' query parameters. Includes an example of including metadata for pagination UI. ```bash GET /items/codex?limit=10&offset=0 GET /items/codex?limit=10&offset=10 GET /items/codex?limit=10&offset=20 GET /items/codex?limit=10&offset=0&meta=* ``` -------------------------------- ### Combining Multiple Query Parameters Source: https://docs.decc0s.com/query-guide An example of combining various query parameters including 'fields', 'filter', 'sort', 'limit', 'offset', and 'meta' for precise API requests. ```HTTP GET /items/codex?fields=id,name,description&filter[ancestor][]=true&sort=-timestamp_created&limit=10&offset=0&meta=* ``` -------------------------------- ### Codex Examples API Source: https://docs.decc0s.com/examples Demonstrates how to query the MOCA Codex knowledge base, including listing items, filtering by owner, searching by name, pagination, and sorting. ```APIDOC ## GET /items/codex ### Description Retrieves a list of codex items from the MOCA knowledge base. Supports filtering, pagination, sorting, and full-text search. ### Method GET ### Endpoint /items/codex ### Parameters #### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to include in the response. - **limit** (integer) - Optional - Maximum number of items to return. - **offset** (integer) - Optional - Number of items to skip for pagination. - **filter** (object) - Optional - Filters for querying codex items. Uses Directus filter syntax. Example: `filter[owner][_eq]=0x...` - **search** (string) - Optional - Performs a full-text search across codex items. - **sort** (string) - Optional - Field to sort by. Prepend with `-` for descending order. Example: `-timestamp_created` - **meta** (string) - Optional - Request metadata about the items. Use `*` for all metadata. ### Request Example ```json { "example": "GET /items/codex?fields=id,name&limit=10&filter[owner][_eq]=0x123..." } ``` ### Response #### Success Response (200) - **data** (array) - An array of codex item objects. - **meta** (object) - Metadata about the query results (e.g., total count, limit, offset). #### Response Example ```json { "example": { "data": [ { "id": "1", "name": "Codex Item Name" } ], "meta": { "total_count": 100, "limit": 10, "offset": 0 } } } ``` ``` ```APIDOC ## GET /items/codex/{id} ### Description Retrieves a single codex item by its unique ID. ### Method GET ### Endpoint /items/codex/{id} ### Parameters #### Path Parameters - **id** (string/integer) - Required - The unique identifier of the codex item. ### Response #### Success Response (200) - **data** (object) - The codex item object. #### Response Example ```json { "example": { "data": { "id": "1", "name": "Specific Codex Item", "owner": "0x123..." } } } ``` ``` -------------------------------- ### Files Examples Source: https://context7_llms Demonstrates how to list files, filter by type, retrieve metadata, and query recent uploads with sorting. ```APIDOC ## GET /files ### Description Retrieves a list of files with options for filtering, sorting, and field selection. ### Method GET ### Endpoint /files ### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to include in the response. - **limit** (integer) - Optional - The maximum number of files to return. - **filter[type][_starts_with]** (string) - Optional - Filter files by MIME type prefix (e.g., 'image/'). - **sort** (string) - Optional - Field to sort by (prefix with '-' for descending order, e.g., '-created_on'). ### Request Example ```json { "example": "GET /files?fields=id,title,type&limit=10&filter[type][_starts_with]=image/&sort=-created_on" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier (UUID) of the file. - **title** (string) - The title of the file. - **type** (string) - The MIME type of the file. - **created_on** (string) - The timestamp when the file was uploaded. #### Response Example ```json { "example": "{\"data\": [{\"id\": \"some-uuid\", \"title\": \"My Image\", \"type\": \"image/jpeg\", \"created_on\": \"2023-10-27T10:00:00Z\"}]}" } ``` ``` -------------------------------- ### Query Guide Source: https://context7_llms This section provides a comprehensive guide to using query parameters to filter, sort, search, and paginate results from the MOCA Codex API. It covers field selection, filtering syntax with various operators, logical operators for complex queries, sorting by ascending or descending order, and pagination using limit and offset. ```APIDOC ## Query Parameters Overview ### Description Overview of available query parameters for the MOCA Codex API. ### Query Parameters - **fields** (string) - Optional - Select specific fields to return. Example: `?fields=id,name` - **filter** (string) - Optional - Apply filter conditions. Example: `?filter[name][_eq]=Korka` - **sort** (string) - Optional - Order results. Example: `?sort=-created_on` - **limit** (integer) - Optional - Maximum number of results to return. Example: `?limit=25` - **offset** (integer) - Optional - Skip a number of results (for pagination). Example: `?offset=50` - **search** (string) - Optional - Perform a full-text search. Example: `?search=curator` - **meta** (string) - Optional - Include metadata. Example: `?meta=*` ## Field Selection ### Description Use the `fields` parameter to specify which fields to include in the response. ### Method GET ### Endpoint `/items/codex` ### Parameters #### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to include. Example: `id,name,description` ### Request Example ```bash GET /items/codex?fields=id,name,description ``` ### Response #### Success Response (200) - **id** (integer) - Unique identifier of the item. - **name** (string) - Name of the item. - **description** (string) - Description of the item. #### Response Example ```json { "id": 1, "name": "Example Item", "description": "This is an example item." } ``` ## Filtering ### Description Filter results based on specified criteria using Directus filter syntax. ### Method GET ### Endpoint `/items/codex` ### Parameters #### Query Parameters - **filter** (string) - Optional - Filter conditions. Can be in bracket notation (e.g., `?filter[name][_eq]=Korka`) or JSON format (e.g., `?filter={"name":{"_eq":"Korka"}}`). ### Filter Operators - `_eq`: Equals - `_neq`: Not equals - `_lt`: Less than - `_lte`: Less than or equal - `_gt`: Greater than - `_gte`: Greater than or equal - `_in`: In array - `_nin`: Not in array - `_null`: Is null - `_nnull`: Is not null - `_contains`: Contains substring - `_ncontains`: Doesn't contain substring - `_starts_with`: Starts with - `_nstarts_with`: Doesn't start with - `_ends_with`: Ends with - `_nends_with`: Doesn't end with - `_between`: Between values - `_nbetween`: Not between values - `_empty`: Is empty - `_nempty`: Is not empty ### Filter Examples ```bash GET /items/codex?filter[name][_eq]=Korka GET /items/codex?filter[description][_contains]=curator GET /items/codex?filter[id][_gt]=100 GET /items/codex?filter[ancestor][_nnull]=true ``` ## Logical Operators ### Description Combine multiple filter conditions using logical operators like AND and OR. ### Method GET ### Endpoint `/items/codex` ### Parameters #### Query Parameters - **filter** (string) - Optional - Complex filter conditions using `_and` or `_or` operators within JSON format. ### Examples **AND:** ```bash GET /items/codex?filter={"_and":[{"id":{\"_gte\":1}},{"name":{\"_nnull\":true}}]} ``` **OR:** ```bash GET /items/codex?filter={"_or":[{"name":{\"_eq\":\"Korka\"}},{"name":{\"_eq\":\"Aria\"}}]} ``` **Complex Nesting:** ```json GET /items/codex?filter={"_and":[{"owner":{\"_eq\":\"0x614a...\"}},{"_or":[{"id":{\"_lt\":100}},{"id":{\"_gt\":200}}]}]} ``` ## Sorting ### Description Order the results by one or more fields in ascending or descending order. ### Method GET ### Endpoint `/items/codex` ### Parameters #### Query Parameters - **sort** (string) - Optional - Field(s) to sort by. Prefix with `-` for descending order. Example: `name` or `-timestamp_created,name`. ### Examples **Ascending Order:** ```bash GET /items/codex?sort=name ``` **Descending Order:** ```bash GET /items/codex?sort=-timestamp_created ``` **Multiple Sort Fields:** ```bash GET /items/codex?sort=-timestamp_created,name ``` ## Pagination ### Description Control the number of results returned and the starting point for the result set. ### Method GET ### Endpoint `/items/codex` ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of items to return. Default is usually 25. - **offset** (integer) - Optional - The number of items to skip from the beginning of the result set. Default is 0. ### Request Example ```bash GET /items/codex?limit=10&offset=20 ``` ``` -------------------------------- ### Filtering Examples Source: https://context7_llms Provides examples of how to filter codex items using various criteria. ```APIDOC ## Filtering Examples ### Filter by Name ```bash curl "${API_BASE_URL}/items/codex?filter[name][_contains]=Korka" ``` ### Filter by Owner Address **Important**: Owner addresses must be lowercase. ```bash curl "${API_BASE_URL}/items/codex?filter[owner][_eq]=0x614a61a3b7f2fd8750acaad63b2a0cfe8b8524f1" ``` ### Complex Filters Combine multiple conditions: ```bash curl "${API_BASE_URL}/items/codex?filter={"_and":[{"owner":{"_eq":"0x614a61a3b7f2fd8750acaad63b2a0cfe8b8524f1"}},{"id":{"_gte":100}}]}"" ``` ``` -------------------------------- ### Assets Examples Source: https://context7_llms Demonstrates how to apply preset transformations, custom dimensions, format conversions, and advanced image processing using the Sharp API. ```APIDOC ## GET /assets/{id} ### Description Retrieves an asset with specified transformations and options. ### Method GET ### Endpoint /assets/{id} ### Path Parameters - **id** (string) - Required - The identifier of the asset. ### Query Parameters - **key** (string) - Optional - Apply a predefined transformation preset (e.g., 's512'). - **width** (integer) - Optional - Set a custom width for the asset. - **height** (integer) - Optional - Set a custom height for the asset. - **format** (string) - Optional - Convert the asset to a different format (e.g., 'webp'). - **quality** (integer) - Optional - Set the quality for image formats (0-100). - **transforms** (string) - Optional - A JSON string representing an array of Sharp API transformations (e.g., '[["rotate",90]]'). ### Request Example ```json { "example": "GET /assets/some-asset-id?key=s512&width=800&height=600&format=webp&quality=80&transforms=[[\"rotate\",90]]" } ``` ### Response #### Success Response (200) - **(Binary)** - The transformed asset data (image, etc.). #### Response Example ```json { "example": "(Binary image data)" } ``` ``` -------------------------------- ### Filtering Examples Source: https://docs.decc0s.com/codex Examples demonstrating how to filter codex items based on various criteria, including name, owner address, and complex combined conditions. ```APIDOC ## Filtering Examples ### Filter by Name Retrieve codex items where the name contains 'Korka'. ```curl https://api.decc0s.com/items/codex?filter[name][_contains]=Korka ``` ### Filter by Owner Address Retrieve codex items filtered by a specific owner address. **Note:** Owner addresses must be in lowercase. ```curl https://api.decc0s.com/items/codex?filter[owner][_eq]=0x614a61a3b7f2fd8750acaad63b2a0cfe8b8524f1 ``` ### Complex Filters Combine multiple filter conditions using the `_and` operator. This example filters items by owner address and an ID greater than or equal to 100. ```curl https://api.decc0s.com/items/codex?filter={\"_and\":[{\"owner\":{\"_eq\":\"0x614a61a3b7f2fd8750acaad63b2a0cfe8b8524f1\"}},{\"id\":{\"_gte\":100}}]} ``` ``` -------------------------------- ### Example Error Response Structure Source: https://docs.decc0s.com/getting-started Shows the JSON format for error responses from the MOCA Codex API. It includes an 'errors' array, with each error object containing a message and extensions like an error code. ```json { "errors": [ { "message": "Item not found", "extensions": { "code": "NOT_FOUND" } } ] } ``` -------------------------------- ### Item Retrieval and Pagination Source: https://docs.decc0s.com/query-guide Retrieve items with options for pagination. The `limit` parameter controls the number of items per page, and `offset` specifies the starting point. Including `meta=*` provides pagination metadata such as total counts. ```APIDOC ## GET /items/codex ### Description Retrieves a paginated list of items. ### Method GET ### Endpoint /items/codex ### Query Parameters - **limit** (integer) - Optional - The number of items to return per page. - **offset** (integer) - Optional - The starting offset for pagination. - **meta** (string) - Optional - Include metadata. Use `*` for all metadata (e.g., `total_count`, `filter_count`). ### Request Example ```http GET /items/codex?limit=10&offset=0&meta=* ``` ### Response #### Success Response (200) - **data** (array) - The list of items. - **meta** (object) - Metadata about the response, including `filter_count` and `total_count`. #### Response Example ```json { "data": [ ... ], "meta": { "filter_count": 42, "total_count": 100 } } ``` ``` -------------------------------- ### Combining Query Parameters Example Source: https://context7_llms Demonstrates how to combine various query parameters like 'fields', 'filter', 'sort', 'limit', 'offset', and 'meta' for precise data retrieval. ```bash GET /items/codex?fields=id,name,description&filter[ancestor][_nnull]=true&sort=-timestamp_created&limit=10&offset=0&meta=* ``` -------------------------------- ### Fetch Specific Codex Item Source: https://docs.decc0s.com/getting-started Retrieves a single codex item by its unique ID. ```APIDOC ## GET /items/codex/{id} ### Description Retrieves a single codex item by its ID. ### Method GET ### Endpoint `https://api.decc0s.com/items/codex/{id}` ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the codex item. #### Query Parameters - **fields** (string) - Optional - Specifies which fields to include in the response. - **meta** (string) - Optional - Requests metadata to be included in the response. ### Request Example ```bash curl "https://api.decc0s.com/items/codex/1" ``` ### Response #### Success Response (200) - **data** (object) - The requested codex item object. - **meta** (object) - Optional metadata about the response. #### Response Example ```json { "data": { "id": 1, "name": "Korka", "ancestor": "Slovenian king", "description": "A contemplative curator..." } } ``` ``` -------------------------------- ### Get File Metadata API Source: https://docs.decc0s.com/examples Retrieves detailed metadata for a specific file using its UUID. This includes information such as Exif, IPTC, and dimensions. ```http GET /files/{uuid} ``` -------------------------------- ### List Files API Source: https://docs.decc0s.com/examples Retrieves a list of files, specifying fields to return and a limit. This is useful for managing and browsing stored files. ```http GET /files?fields=id,title,type&limit=10 ``` -------------------------------- ### Fetch Codex Items with Curl Source: https://docs.decc0s.com/getting-started Retrieves a list of codex items from the MOCA Codex API. This is a basic GET request to the API's codex endpoint. It assumes the base URL is https://api.decc0s.com. ```shell curl "https://api.decc0s.com/items/codex" ``` -------------------------------- ### Apply Preset Image Transformation API Source: https://docs.decc0s.com/examples Applies a predefined image transformation preset to an asset. The `key` parameter specifies which preset to use, such as resizing to 512px. ```http GET /assets/{id}?key=s512 ``` -------------------------------- ### Filter Files by Type (cURL) Source: https://docs.decc0s.com/files Example demonstrating how to filter files based on their MIME type using a cURL request. This endpoint requires the 'type' field to start with a specified string. ```curl curl "https://api.decc0s.com/files?filter[type][_starts_with]=image/" ``` -------------------------------- ### Filter Files by Image Type (Bash) Source: https://context7_llms Retrieve only image files from the collection by filtering based on the MIME type. This example shows how to get all image types using a `_starts_with` operator and how to filter for a specific type, like JPEG, using the `_eq` operator. Common MIME types for various file formats are listed. ```bash GET /files?filter[type][_starts_with]=image/&fields=id,title,type,width,height ``` ```bash GET /files?filter[type][_eq]=image/jpeg&fields=id,title,type,width,height ``` -------------------------------- ### Get Asset Source: https://docs.decc0s.com/files Retrieve the actual file content (asset) by its unique identifier. Supports image transformations. ```APIDOC ## Get Asset ### Description Retrieve the actual file content (asset) by its unique identifier. This endpoint returns the raw file data and supports image transformations. ### Method GET ### Endpoint /assets/{id} ### Path Parameters - **id** (string) - Required - The unique identifier of the file (UUID) ### Query Parameters #### Image Transformation Parameters - **width** (integer) - Optional - Desired width in pixels - **height** (integer) - Optional - Desired height in pixels - **quality** (integer) - Optional - Compression quality (0-100) - **fit** (string) - Optional - How image fits dimensions: `cover`, `contain`, `inside`, `outside` - **format** (string) - Optional - Output format: `jpeg`, `png`, `webp`, `tiff`, `avif` - **key** (string) - Optional - Preset transformation key (e.g., `s512`) - **transforms** (string) - Optional - JSON array of Sharp API transformations ### Transformation Presets - `s128`: Resize to 128px width - `s256`: Resize to 256px width - `s512`: Resize to 512px width - `s1024`: Resize to 1024px width ### Example: Basic Asset Request ```bash curl "https://api.decc0s.com/assets/a1b2c3d4-e5f6-7890-1234-abcdef123456" ``` ### Example: Resize with Preset ```bash curl "https://api.decc0s.com/assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?key=s512" ``` ### Example: Custom Transformation ```bash curl "https://api.decc0s.com/assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?width=800&height=600&fit=cover&format=webp&quality=80" ``` ### Example: Sharp Transformations ```bash curl "https://api.decc0s.com/assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?transforms=\"[[]",\"rotate\",90\"],[[]\",\"blur\",10]]\"" ``` ### Sharp API The `transforms` parameter accepts Sharp API operations like `rotate`, `resize`, `blur`, `sharpen`, `tint`, `greyscale`, `negate`, and `normalize`. See the Sharp documentation for all available options. ``` -------------------------------- ### Select Specific Fields with Curl Source: https://docs.decc0s.com/getting-started Requests only specific fields (id, name, description) for codex items. This is useful for optimizing data transfer by only fetching necessary information. ```shell curl "https://api.decc0s.com/items/codex?fields=id,name,description" ``` -------------------------------- ### Pagination with Metadata Inclusion Source: https://docs.decc0s.com/query-guide Shows how to include metadata, such as total item counts, in API responses for pagination UI purposes by appending 'meta=*'. ```HTTP GET /items/codex?limit=10&offset=0&meta=* ``` -------------------------------- ### Search Files by Keyword (cURL) Source: https://docs.decc0s.com/files Example of how to search for files containing a specific keyword in their content or metadata using a cURL request. The 'search' parameter is used for this functionality. ```curl curl "https://api.decc0s.com/files?search=profile" ``` -------------------------------- ### Filter Files by Type (Images) API Source: https://docs.decc0s.com/examples Retrieves only image files from the storage. This filter uses the `_starts_with` operator to match file types beginning with 'image/'. ```http GET /files?filter[type][_starts_with]=image/ ``` -------------------------------- ### Combining Parameters Source: https://docs.decc0s.com/query-guide Combine multiple query parameters such as `fields`, `filter`, `sort`, `limit`, `offset`, and `meta` for precise and efficient data retrieval. ```APIDOC ## GET /items/codex?... ### Description Retrieves items with a combination of query parameters for detailed filtering, sorting, and field selection. ### Method GET ### Endpoint /items/codex ### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to include in the response. - **filter** (object) - Optional - Filter criteria for the query. - **sort** (string) - Optional - Sorting order for the results (e.g., `-timestamp_created` for descending). - **limit** (integer) - Optional - The number of items to return per page. - **offset** (integer) - Optional - The starting offset for pagination. - **meta** (string) - Optional - Include metadata. Use `*` for all metadata. ### Request Example ```http GET /items/codex?fields=id,name,description&filter[ancestor][_nnull]=true&sort=-timestamp_created&limit=10&offset=0&meta=* ``` ### Response #### Success Response (200) - **data** (array) - The list of items matching the combined query parameters. - **meta** (object) - Metadata about the response. #### Response Example ```json { "data": [ ... ], "meta": { "filter_count": 10, "total_count": 100 } } ``` ``` -------------------------------- ### Get File by ID Source: https://docs.decc0s.com/files Retrieves a specific file by its unique identifier. ```APIDOC ## GET /files/{id} ### Description Retrieves a specific file by its unique identifier. ### Method GET ### Endpoint /files/{id} ### Parameters #### Path Parameters - **id** (string (UUID)) - Required - The unique identifier of the file. ### Response #### Success Response (200) - **id** (string) - Unique identifier - **storage** (string) - Storage location identifier - **filename_disk** (string) - Name of the file on disk - **filename_download** (string) - Name used when downloading - **title** (string) - User-defined title - **type** (string) - MIME type - **folder** (string) - Folder identifier - **uploaded_by** (string) - User who uploaded the file - **created_on** (datetime) - Upload timestamp - **filesize** (integer) - File size in bytes - **width** (integer) - Image width in pixels - **height** (integer) - Image height in pixels - **duration** (integer) - Duration for audio/video in seconds - **description** (string) - File description - **location** (string) - Geographic location - **tags** (array) - Array of tags - **metadata** (object) - Extracted metadata (Exif, IPTC, ICC) - **focal_point_x** (number) - Focal point X coordinate - **focal_point_y** (number) - Focal point Y coordinate #### Response Example ```json { "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "storage": "s3", "filename_disk": "my_image.jpg", "filename_download": "my_image.jpg", "title": "My Awesome Image", "type": "image/jpeg", "folder": "user_uploads", "uploaded_by": "user123", "created_on": "2024-01-15T10:30:00Z", "filesize": 102400, "width": 800, "height": 600, "duration": null, "description": "A beautiful landscape.", "location": "Mountain View", "tags": ["landscape", "nature"], "metadata": {}, "focal_point_x": 0.5, "focal_point_y": 0.5 } } ``` ``` -------------------------------- ### Files API Source: https://docs.decc0s.com/examples Endpoints for accessing and filtering stored files, including listing files, filtering by type, retrieving metadata, and querying recent uploads. ```APIDOC ## GET /files ### Description Retrieves a list of stored files. Supports filtering by type, sorting, and pagination. ### Method GET ### Endpoint /files ### Parameters #### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to include in the response. - **limit** (integer) - Optional - Maximum number of files to return. - **sort** (string) - Optional - Field to sort by. Prepend with `-` for descending order. Example: `-created_on` - **filter** (object) - Optional - Filters for querying files. Example: `filter[type][_starts_with]=image/` ### Request Example ```json { "example": "GET /files?fields=id,title,type&limit=10&sort=-created_on" } ``` ### Response #### Success Response (200) - **data** (array) - An array of file objects. #### Response Example ```json { "example": { "data": [ { "id": "file_uuid_1", "title": "My Image", "type": "image/jpeg" } ] } } ``` ``` ```APIDOC ## GET /files/{uuid} ### Description Retrieves metadata for a specific file using its UUID. ### Method GET ### Endpoint /files/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier (UUID) of the file. ### Response #### Success Response (200) - **data** (object) - The file metadata object. #### Response Example ```json { "example": { "data": { "id": "file_uuid_1", "title": "My Image", "type": "image/jpeg", "filesize": 102400, "width": 800, "height": 600 } } } ``` ``` -------------------------------- ### Apply Custom Image Size Transformation API Source: https://docs.decc0s.com/examples Applies custom width and height transformations to an image asset. This allows for precise control over the output dimensions. ```http GET /assets/{id}?width=800&height=600 ``` -------------------------------- ### Metadata Inclusion with 'meta' Parameter Source: https://docs.decc0s.com/query-guide Demonstrates how to request additional metadata, such as total counts, by including the 'meta' parameter in the query. ```HTTP GET /items/codex?meta=*&limit=10 ``` -------------------------------- ### List Codex Items API Request (Bash) Source: https://context7_llms Example of how to retrieve a paginated list of codex items using cURL. This demonstrates specifying fields to include and requesting metadata. ```bash curl "${API_BASE_URL}/items/codex?fields=id,name,description&limit=10&meta=*" ``` -------------------------------- ### Get File by ID Source: https://docs.decc0s.com/files Retrieve a single file's metadata by its unique identifier (UUID). ```APIDOC ## Get File by ID ### Description Retrieve a single file's metadata by its unique identifier. ### Method GET ### Endpoint /files/{id} ### Path Parameters - **id** (string) - Required - The unique identifier of the file (UUID) ### Request Example ```bash curl "https://api.decc0s.com/files/a1b2c3d4-e5f6-7890-1234-abcdef123456" ``` ### Response #### Success Response (200) - **data** (object) - The file object containing metadata. #### Response Example ```json { "data": { "id": "a1b2c3d4-e5f6-7890-1234-abcdef123456", "storage": "local", "filename_disk": "image-1234567890.jpg", "filename_download": "profile-photo.jpg", "title": "Profile Photo", "type": "image/jpeg", "folder": null, "uploaded_by": "admin-user-id", "created_on": "2025-01-15T10:30:00Z", "filesize": 245678, "width": 1920, "height": 1080, "description": "User profile photo", "tags": [], "metadata": { "exif": { "Make": "Canon", "Model": "EOS 5D Mark IV" } } } } ``` ``` -------------------------------- ### Pagination Calculation Logic Source: https://docs.decc0s.com/query-guide Provides the formulas for calculating the total number of pages and the current page based on total count, limit, and offset. ```Plain Text Total Pages = ceil(total_count / limit) Current Page = floor(offset / limit) + 1 ``` -------------------------------- ### Complex Filter with OR Logic Source: https://docs.decc0s.com/examples Demonstrates building complex filters using the `_or` operator within JSON syntax. This allows combining multiple filter conditions with logical OR. ```http GET "/items/codex?filter={\"_or\":[{"name":{\"_eq\":\"ItemA\"}},{"name":{\"_eq\":\"ItemB\"}}]}" ``` -------------------------------- ### Asset Transformations API Source: https://docs.decc0s.com/examples Endpoints for applying transformations to assets (images), including preset transformations, custom resizing, format conversion, and advanced Sharp API operations. ```APIDOC ## GET /assets/{id} ### Description Applies transformations to an asset (image) and returns the transformed image. Supports preset transformations, custom dimensions, format conversion, and quality settings. ### Method GET ### Endpoint /assets/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the asset. #### Query Parameters - **key** (string) - Optional - Applies a predefined transformation preset. Example: `s512` for a 512px square resize. - **width** (integer) - Optional - Sets the desired width for the transformed image. - **height** (integer) - Optional - Sets the desired height for the transformed image. - **format** (string) - Optional - Converts the image to a specified format (e.g., `webp`). - **quality** (integer) - Optional - Sets the quality for the transformed image (0-100). - **transforms** (array) - Optional - An array of raw Sharp transformation instructions. Example: `transforms=[["rotate",90]]` ### Request Example ```json { "example": "GET /assets/asset_id?width=800&height=600&format=webp&quality=80" } ``` ### Response #### Success Response (200) - Returns the transformed image file. #### Response Example (Binary image data) ``` -------------------------------- ### Filter by Null Value Operator Source: https://docs.decc0s.com/examples Demonstrates the use of the `_null` operator to filter items where a specific field is null. Useful for finding records with missing data. ```http GET /items/codex?filter[ancestor][_null]=true ``` -------------------------------- ### Pagination Source: https://docs.decc0s.com/query-guide Control the result set size using `limit` to specify the maximum number of results and `offset` to skip a certain number of results for pagination. ```APIDOC ## Pagination Control result set size using `limit` and `offset`. ### Basic Pagination ``` GET /items/codex?limit=25&offset=50 ``` ``` -------------------------------- ### Filter Codex Items by Name with Curl Source: https://docs.decc0s.com/getting-started Filters codex items by name using Directus filter syntax. This example retrieves items where the 'name' field contains 'Korka'. It utilizes query parameters for filtering. ```shell curl "https://api.decc0s.com/items/codex?filter[name][_contains]=Korka" ``` -------------------------------- ### Fetch Specific Codex Item with Curl Source: https://docs.decc0s.com/getting-started Retrieves a single codex item by its ID from the MOCA Codex API. Replace '1' with the desired item ID. This is a GET request to a specific item endpoint. ```shell curl "https://api.decc0s.com/items/codex/1" ``` -------------------------------- ### Get Single Codex Item by ID API Source: https://docs.decc0s.com/examples Fetches a specific Codex item using its unique identifier. This is useful for retrieving detailed information about a particular entity. ```http GET /items/codex/1 ``` -------------------------------- ### Include Metadata in Response with Curl Source: https://docs.decc0s.com/getting-started Requests to include metadata, such as filter counts and total counts, in the API response. This is achieved by appending '?meta=*' to the request URL. ```shell curl "https://api.decc0s.com/items/codex?meta=*" ``` -------------------------------- ### Get Codex Item by ID API Request (Bash) Source: https://context7_llms Example of how to retrieve a specific codex item by its unique identifier using cURL. This shows a basic request for a single item. ```bash curl "${API_BASE_URL}/items/codex/1" ``` -------------------------------- ### Apply Image Format and Quality Transformation API Source: https://docs.decc0s.com/examples Converts an image asset to a specified format (e.g., WebP) and sets the desired quality level. This is useful for optimizing image delivery. ```http GET /assets/{id}?format=webp&quality=80 ``` -------------------------------- ### Combine Null Checks: Name and Description Source: https://context7_llms This example demonstrates how to find items that have both a name and a description by using non-null filters for both fields. It uses the `_nnull` operator to ensure that neither the 'name' nor the 'description' field is null. The output includes 'id', 'name', and 'description' for up to 10 items. ```Bash GET /items/codex?filter[name][_nnull]=true&filter[description][_nnull]=true ``` -------------------------------- ### Sort Codex Items by Creation Date (Descending) Source: https://context7_llms Retrieves the most recently created codex items. This example demonstrates sorting by the 'timestamp_created' field in descending order, limiting results to 10, and selecting specific fields. It uses a GET request to the '/items/codex' endpoint. ```bash GET /items/codex?sort=-timestamp_created&limit=10&fields=id,name,timestamp_created ``` -------------------------------- ### List Files Source: https://docs.decc0s.com/files Retrieves a list of files. Supports filtering, searching, and sorting. ```APIDOC ## GET /files ### Description Retrieves a list of files. Supports filtering, searching, and sorting. ### Method GET ### Endpoint /files ### Parameters #### Query Parameters - **filter[type][_starts_with]** (string) - Optional - Filters files by type, starting with the specified string. - **filter[created_on][_gte]** (datetime) - Optional - Filters files created on or after the specified date. - **sort** (string) - Optional - Specifies the sorting order. Prefix with '-' for descending order (e.g., '-created_on'). - **search** (string) - Optional - Searches files based on a keyword. ### Request Example ```json { "example": "curl \"https://api.decc0s.com/files?filter[type][_starts_with]=image/\"" } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier - **storage** (string) - Storage location identifier - **filename_disk** (string) - Name of the file on disk - **filename_download** (string) - Name used when downloading - **title** (string) - User-defined title - **type** (string) - MIME type - **folder** (string) - Folder identifier - **uploaded_by** (string) - User who uploaded the file - **created_on** (datetime) - Upload timestamp - **filesize** (integer) - File size in bytes - **width** (integer) - Image width in pixels - **height** (integer) - Image height in pixels - **duration** (integer) - Duration for audio/video in seconds - **description** (string) - File description - **location** (string) - Geographic location - **tags** (array) - Array of tags - **metadata** (object) - Extracted metadata (Exif, IPTC, ICC) - **focal_point_x** (number) - Focal point X coordinate - **focal_point_y** (number) - Focal point Y coordinate #### Response Example ```json { "example": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "storage": "s3", "filename_disk": "my_image.jpg", "filename_download": "my_image.jpg", "title": "My Awesome Image", "type": "image/jpeg", "folder": "user_uploads", "uploaded_by": "user123", "created_on": "2024-01-15T10:30:00Z", "filesize": 102400, "width": 800, "height": 600, "duration": null, "description": "A beautiful landscape.", "location": "Mountain View", "tags": ["landscape", "nature"], "metadata": {}, "focal_point_x": 0.5, "focal_point_y": 0.5 } ] } ``` ``` -------------------------------- ### Complex Filter with AND Logic Source: https://docs.decc0s.com/examples Demonstrates building complex filters using the `_and` operator within JSON syntax. This allows combining multiple filter conditions with logical AND. ```http GET "/items/codex?filter={\"_and\":[{"name":{\"_eq\":\"Example\"}},{"status":{\"_neq\":\"draft\"}}]}" ``` -------------------------------- ### Retrieve Image with Preset (HTTP) Source: https://docs.decc0s.com/examples/assets/presets Fetches an image using a pre-defined transformation preset. The `key` parameter specifies the preset to apply, such as `s512` for a 512px width resize. Available presets include s128, s256, s512, and s1024. ```HTTP GET /assets/{id}?key=s512 ``` ```HTTP GET /assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?key=s128 ``` ```HTTP GET /assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?key=s512 ``` ```HTTP GET /assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?key=s1024 ``` -------------------------------- ### Get File Metadata Source: https://context7_llms Retrieves the metadata for a specific file using its UUID. ```APIDOC ## GET /files/{uuid} ### Description Retrieves the metadata for a specific file identified by its UUID. ### Method GET ### Endpoint /files/{uuid} ### Path Parameters - **uuid** (string) - Required - The unique identifier (UUID) of the file. ### Response #### Success Response (200) - **id** (string) - The unique identifier (UUID) of the file. - **title** (string) - The title of the file. - **type** (string) - The MIME type of the file. - **filename** (string) - The original filename. #### Response Example ```json { "example": "{\"data\": {\"id\": \"some-uuid\", \"title\": \"My Image\", \"type\": \"image/jpeg\", \"filename\": \"my_image.jpg\"}}" } ``` ``` -------------------------------- ### Retrieve Images with Transformation Presets Source: https://context7_llms Fetch images using predefined transformation presets specified by the `key` parameter. These presets, such as `s128`, `s256`, `s512`, and `s1024`, consistently resize images to a defined width while maintaining aspect ratio. ```bash GET /assets/{id}?key=s512 ``` ```bash # Thumbnail (128px) GET /assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?key=s128 ``` ```bash # Card preview (512px) GET /assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?key=s512 ``` ```bash # Full size (1024px) GET /assets/a1b2c3d4-e5f6-7890-1234-abcdef123456?key=s1024 ```