### Get All Configuration Settings
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve all system-wide and user-specific configuration settings.
```bash
curl "http://localhost:6363/api/config"
```
--------------------------------
### Get All Users
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve a list of all users in the system.
```bash
curl "http://localhost:6363/api/users"
```
--------------------------------
### Get All Roles
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve a list of all available roles in the system.
```bash
curl "http://localhost:6363/api/users/roles"
```
--------------------------------
### Install wasm-tools Workload
Source: https://github.com/webreaper/damselfly/blob/master/docs/Contributing.md
Before building Damselfly locally, ensure you have the wasm-tools workload installed. This is a prerequisite for the .NET build process.
```bash
dotnet workload install wasm-tools
```
--------------------------------
### Get Export Configurations
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve a list of all saved export configurations.
```bash
curl "http://localhost:6363/api/export/configs"
```
--------------------------------
### Get Desktop App Paths
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve the paths associated with the desktop application.
```bash
curl "http://localhost:6363/api/download/desktopapppaths"
```
--------------------------------
### Get Specific Configuration Setting
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve the value of a single configuration setting by its name.
```bash
curl "http://localhost:6363/api/config/LogLevel"
```
--------------------------------
### Get All Folders
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieves a list of all folders in the system. Useful for browsing the folder hierarchy.
```bash
curl "http://localhost:6363/api/folders"
```
--------------------------------
### Get User Configuration Settings
Source: https://context7.com/webreaper/damselfly/llms.txt
Fetch configuration settings for a specific user, identified by their User ID.
```bash
curl "http://localhost:6363/api/config/user/1"
```
--------------------------------
### Start Damselfly Server
Source: https://context7.com/webreaper/damselfly/llms.txt
Specify the source directory for photos. Supports custom ports, verbose logging, Synology thumbnail compatibility, read-only mode, and disabling indexing or thumbnail generation.
```bash
# Basic startup with photo directory
./Damselfly /path/to/photos
```
```bash
# Run on custom port with verbose logging
./Damselfly /path/to/photos --port 8080 --verbose
```
```bash
# Enable Synology native thumbnail structure
./Damselfly /path/to/photos --syno
```
```bash
# Read-only mode (no indexing or thumbnail generation)
./Damselfly /path/to/photos --readonly
```
```bash
# Custom config and thumbnail paths
./Damselfly /path/to/photos --config /data/config --thumbs /data/thumbs
```
```bash
# Disable thumbnail generation
./Damselfly /path/to/photos --nothumbs
```
```bash
# Disable indexing
./Damselfly /path/to/photos --noindex
```
--------------------------------
### Get CPU Settings
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve the current CPU scheduling settings for background work.
```bash
curl "http://localhost:6363/api/work/settings"
```
--------------------------------
### Get System Settings
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve all current system-wide settings. The response includes various flags and parameters for AI processing, authentication, and logging.
```bash
curl "http://localhost:6363/api/config/settings"
```
--------------------------------
### Get All Tags
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieves a list of all tags associated with images. Useful for browsing available tags.
```bash
curl "http://localhost:6363/api/tags"
```
--------------------------------
### Get User Folder States
Source: https://context7.com/webreaper/damselfly/llms.txt
Fetches the view state (expanded/collapsed) of folders for a specific user. Requires UserId.
```bash
curl "http://localhost:6363/api/folders/states/1"
```
--------------------------------
### Get Basket Entries (Images in Basket)
Source: https://context7.com/webreaper/damselfly/llms.txt
Lists all images contained within a specific basket. Requires the BasketId.
```bash
curl "http://localhost:6363/api/basket/entries/5"
```
--------------------------------
### Get Work Status
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve the current status of background processing.
```bash
curl "http://localhost:6363/api/work/status"
```
--------------------------------
### Get User by ID
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve a specific user's details using their unique ID.
```bash
curl "http://localhost:6363/api/user/1"
```
--------------------------------
### Get Recent Tags
Source: https://context7.com/webreaper/damselfly/llms.txt
Fetches a list of recently used or added tags. Useful for seeing current activity.
```bash
curl "http://localhost:6363/api/tags/recents"
```
--------------------------------
### Get Default Basket for User
Source: https://context7.com/webreaper/damselfly/llms.txt
Fetches the default basket for a given user. This is often used for quick selections.
```bash
curl "http://localhost:6363/api/basketdefault/1"
```
--------------------------------
### Get Person by ID
Source: https://context7.com/webreaper/damselfly/llms.txt
Fetches details for a specific person using their unique ID. Use when you know the person's ID.
```bash
curl "http://localhost:6363/api/person/1"
```
--------------------------------
### Get All People
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieves a list of all identified and unidentified people. Useful for an overview of recognized individuals.
```bash
curl "http://localhost:6363/api/people/all"
```
--------------------------------
### Get All Scheduled Tasks
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve a list of all background tasks currently scheduled or running. The response includes task ID, type, and status.
```bash
curl "http://localhost:6363/api/tasks"
```
--------------------------------
### Get Single Tag by ID
Source: https://context7.com/webreaper/damselfly/llms.txt
Fetches a specific tag using its unique identifier. Use when you know the tag ID.
```bash
curl "http://localhost:6363/api/tag/1"
```
--------------------------------
### Get All Baskets for a User
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieves all baskets belonging to a specific user. Use the user's ID to fetch their collections.
```bash
curl "http://localhost:6363/api/baskets/1"
```
--------------------------------
### Get Favourite Tags
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieves only the tags that have been marked as favorites. Useful for quick access to important tags.
```bash
curl "http://localhost:6363/api/tags/favourites"
```
--------------------------------
### Get Cache Version
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/index.html
Retrieves the current cache version, presumably defined by a global constant `CACHE_VERSION`.
```javascript
function getClientVersion() {
return CACHE_VERSION;
}
```
--------------------------------
### Get Basket by ID
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieves a specific basket using its unique identifier. Useful for accessing a particular collection.
```bash
curl "http://localhost:6363/api/basket/5"
```
--------------------------------
### Get People with Filtering
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieves a list of people with advanced filtering options, including search text, state, and pagination. Useful for targeted searches.
```bash
curl -X POST "http://localhost:6363/api/people" \
-H "Content-Type: application/json" \
-d '{
"SearchText": "John",
"State": "Identified",
"Start": 0,
"Count": 50
}'
```
--------------------------------
### Create New User
Source: https://context7.com/webreaper/damselfly/llms.txt
Create a new user account with specified username, email, password, and roles.
```bash
curl -X PUT "http://localhost:6363/api/users" \
-H "Content-Type: application/json" \
-d '{
"UserName": "newuser",
"Email": "newuser@example.com",
"Password": "SecurePass123!",
"Roles": ["User", "Editor"]
}'
```
--------------------------------
### Register New Account
Source: https://context7.com/webreaper/damselfly/llms.txt
Register a new user account, requiring email, password, and password confirmation.
```bash
curl -X POST "http://localhost:6363/api/Accounts" \
-H "Content-Type: application/json" \
-d '{
"Email": "newuser@example.com",
"Password": "SecurePass123!",
"ConfirmPassword": "SecurePass123!"
}'
```
--------------------------------
### Initialize Damselfly Desktop Configuration
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Desktop/index.html
Initializes the configuration for the Damselfly Desktop app by loading settings and validating the URL. Ensure initConfig(), validate(), and the DOM elements with IDs 'url' and 'folder' are available.
```javascript
function initialise() { cfg = initConfig(); document.getElementById("url").value = cfg.url; document.getElementById("folder").value = cfg.folder; validate(); }
initialise();
```
--------------------------------
### Run AI Migration
Source: https://context7.com/webreaper/damselfly/llms.txt
Initiates the AI data migration process. Use when the system indicates a migration is needed.
```bash
curl -X POST "http://localhost:6363/api/people/runaimigration" \
-H "Content-Type: application/json" \
-d '{}'
```
--------------------------------
### Create Export Configuration
Source: https://context7.com/webreaper/damselfly/llms.txt
Define and save a new export configuration. This can be reused for future download operations.
```bash
curl -X PUT "http://localhost:6363/api/export/config" \
-H "Content-Type: application/json" \
-d '{
"Name": "Web Export",
"Type": "Download",
"Size": "Medium",
"KeepFolders": true,
"WatermarkText": "Copyright 2023"
}'
```
--------------------------------
### Configuration API
Source: https://context7.com/webreaper/damselfly/llms.txt
APIs for managing system-wide and user-specific configuration settings.
```APIDOC
## GET /api/config
### Description
Retrieves all system configuration settings.
### Method
GET
### Endpoint
/api/config
```
```APIDOC
## GET /api/config/user/{userId}
### Description
Retrieves configuration settings for a specific user.
### Method
GET
### Endpoint
/api/config/user/{userId}
### Parameters
#### Path Parameters
- **userId** (integer) - Required - The ID of the user whose settings to retrieve.
```
```APIDOC
## GET /api/config/{settingName}
### Description
Retrieves a specific configuration setting.
### Method
GET
### Endpoint
/api/config/{settingName}
### Parameters
#### Path Parameters
- **settingName** (string) - Required - The name of the configuration setting to retrieve.
```
```APIDOC
## PUT /api/config
### Description
Sets or updates a configuration value.
### Method
PUT
### Endpoint
/api/config
### Parameters
#### Request Body
- **Name** (string) - Required - The name of the configuration setting.
- **NewValue** (string) - Required - The new value for the setting.
- **UserId** (integer) - Optional - The ID of the user for user-specific settings. Null for system-wide settings.
### Request Example
```json
{
"Name": "LogLevel",
"NewValue": "Warning",
"UserId": null
}
```
```
```APIDOC
## GET /api/config/settings
### Description
Retrieves all system-wide settings.
### Method
GET
### Endpoint
/api/config/settings
### Response
#### Success Response (200)
- **enableAIProcessing** (boolean) - Indicates if AI processing is enabled.
- **disableObjectDetector** (boolean) - Indicates if the object detector is disabled.
- **writeAITagsToImages** (boolean) - Indicates if AI tags are written to images.
- **enableAuthAndRoles** (boolean) - Indicates if authentication and roles are enabled.
- **forceLogin** (boolean) - Indicates if forced login is enabled.
- **serverLogLevel** (string) - The server's logging level.
- **similarityThreshold** (integer) - The similarity threshold for matching.
- **wpSettings** (object) - WordPress settings.
- **smtpSettings** (object) - SMTP settings.
#### Response Example
```json
{
"enableAIProcessing": true,
"disableObjectDetector": false,
"writeAITagsToImages": false,
"enableAuthAndRoles": true,
"forceLogin": false,
"serverLogLevel": "Information",
"similarityThreshold": 75,
"wpSettings": { "URL": "", "UserName": "", "Password": "" },
"smtpSettings": { ... }
}
```
```
```APIDOC
## POST /api/config/settings
### Description
Updates multiple system settings.
### Method
POST
### Endpoint
/api/config/settings
### Parameters
#### Request Body
- **enableAIProcessing** (boolean) - Enable or disable AI processing.
- **writeAITagsToImages** (boolean) - Enable or disable writing AI tags to images.
- **enableAuthAndRoles** (boolean) - Enable or disable authentication and roles.
- **forceLogin** (boolean) - Enable or disable forced login.
- **serverLogLevel** (string) - Set the server logging level.
- **similarityThreshold** (integer) - Set the similarity threshold.
### Request Example
```json
{
"enableAIProcessing": true,
"writeAITagsToImages": true,
"enableAuthAndRoles": true,
"forceLogin": true,
"serverLogLevel": "Warning",
"similarityThreshold": 80
}
```
```
--------------------------------
### Write File Locally
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/index.html
Initiates a local file download using a provided source URL and a desired local filename. It relies on a global `window.downloadUrl` function.
```javascript
function writeFileLocally(sourceUrl, localFilename) {
window.downloadUrl(sourceUrl, localFilename);
}
```
--------------------------------
### Run Damselfly Server without Docker
Source: https://github.com/webreaper/damselfly/blob/master/docs/Installation.md
Execute the Damselfly server binary from the command line, specifying the path to your photo collection. This is for advanced users running outside of Docker.
```bash
./Damselfly.Web /path/to/my/photos
```
--------------------------------
### Add EF Migration
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Core.DbModels/efmigrations.md
Run this command from the root Damselfly folder to add a new EF migration. Replace {migrationname} with a descriptive name for your migration.
```bash
dotnet ef migrations add {migrationname} --project Damselfly.Migrations.Sqlite --startup-project Damselfly.Web.Server
```
--------------------------------
### Initialize UI State Monitor
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/index.html
Initializes a UI state monitor that listens for window resize events and reports viewport dimensions and user agent information to the .NET backend via `invokeMethodAsync`.
```javascript
window.UIStateMonitor = {
Init: function (DotNetRef) {
function onResize() {
DotNetRef.invokeMethodAsync("HandleViewportSizeChange", window.innerWidth, window.innerHeight);
}
window.addEventListener('resize', onResize);
var state = {
ViewportWidth: window.innerWidth,
ViewportHeight: window.innerHeight,
UserAgent: navigator.userAgent
};
console.log('Evaluating Host Device: \n User - Agent: ' + state.UserAgent + '\n' + ' Viewport(WxH): ' + state.ViewportWidth + 'x' + state.ViewportHeight);
DotNetRef.invokeMethodAsync("InitUIState", state);
}
}
```
--------------------------------
### Set CPU Scheduling
Source: https://context7.com/webreaper/damselfly/llms.txt
Configure CPU scheduling for background work, including daytime and nighttime levels and hours.
```bash
curl -X POST "http://localhost:6363/api/work/settings" \
-H "Content-Type: application/json" \
-d '{
"dayTimeLevel": 2,
"nightTimeLevel": 4,
"nightStartHour": 22,
"nightEndHour": 6
}'
```
--------------------------------
### Mount Multiple Photo Folders in Docker
Source: https://github.com/webreaper/damselfly/blob/master/docs/Installation.md
Configure Docker volumes to include multiple root folders for Damselfly's library. Mount each additional folder as a subfolder within the container's /pictures directory.
```yaml
volumes:
- /volume1/dockerdata/damselfly:/config
- /volume1/dockerdata/damselfly/thumbs:/thumbs
- /volume1/photo:/pictures/photos
- /volume2/otherimages:/pictures/other
- /volume2/familypics:/pictures/familypics
```
--------------------------------
### Create New Basket
Source: https://context7.com/webreaper/damselfly/llms.txt
Creates a new basket for a user. Requires the basket's name and the UserId.
```bash
curl -X PUT "http://localhost:6363/api/basket" \
-H "Content-Type: application/json" \
-d '{
"Name": "Summer 2023 Selection",
"UserId": 1
}'
```
--------------------------------
### Set Text Selection Range
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/index.html
A utility function to set the selection range (start and end positions) for a given HTML element, typically an input or textarea.
```javascript
window.setSelection = (element, start, end) => {
return element.setSelectionRange(start, end);
}
```
--------------------------------
### Set Configuration Value
Source: https://context7.com/webreaper/damselfly/llms.txt
Update a configuration setting. Specify the setting name, new value, and optionally a User ID for user-specific settings.
```bash
curl -X PUT "http://localhost:6363/api/config" \
-H "Content-Type: application/json" \
-d '{
"Name": "LogLevel",
"NewValue": "Warning",
"UserId": null
}'
```
--------------------------------
### Run Damselfly with Docker Command
Source: https://github.com/webreaper/damselfly/blob/master/docs/Installation.md
Use this command to run Damselfly as a Docker container. Ensure volumes are correctly mapped for configuration, thumbnails, and pictures. The container restarts automatically unless stopped.
```bash
docker run \
--name damselfly \
--restart unless-stopped \
-v /volume1/dockerdata/damselfly:/config \
-v /volume1/photo:/pictures \
-v /volume1/dockerdata/damselfly/thumbs:/thumbs \
-p 6363:6363 \
-d \
webreaper/damselfly
```
--------------------------------
### Login User
Source: https://context7.com/webreaper/damselfly/llms.txt
Authenticate a user by providing their email and password. Returns a JWT token on success.
```bash
curl -X POST "http://localhost:6363/api/Login" \
-H "Content-Type: application/json" \
-d '{
"Email": "user@example.com",
"Password": "password123"
}'
```
--------------------------------
### Search Tags by Keyword
Source: https://context7.com/webreaper/damselfly/llms.txt
Finds tags that match a given keyword. Useful for partial matching.
```bash
curl "http://localhost:6363/api/tags/search/vaca"
```
--------------------------------
### Download Images as ZIP Archive
Source: https://context7.com/webreaper/damselfly/llms.txt
Use this endpoint to download multiple images as a ZIP archive. Specify image IDs and configuration options like size and watermarking.
```bash
curl -X POST "http://localhost:6363/api/download/images" \
-H "Content-Type: application/json" \
-d '{
"ImageIds": [1234, 1235, 1236],
"Config": {
"Type": "Download",
"Size": "Large",
"KeepFolders": false,
"WatermarkText": null
}
}'
```
--------------------------------
### Update System Settings
Source: https://context7.com/webreaper/damselfly/llms.txt
Modify multiple system-wide configuration settings at once. This endpoint allows batch updates for parameters like AI processing and logging levels.
```bash
curl -X POST "http://localhost:6363/api/config/settings" \
-H "Content-Type: application/json" \
-d '{
"enableAIProcessing": true,
"writeAITagsToImages": true,
"enableAuthAndRoles": true,
"forceLogin": true,
"serverLogLevel": "Warning",
"similarityThreshold": 80
}'
```
--------------------------------
### Enqueue New Task
Source: https://context7.com/webreaper/damselfly/llms.txt
Use this endpoint to add a new task to the processing queue. Specify the TaskType and Priority.
```bash
curl -X POST "http://localhost:6363/api/tasks/enqueue" \
-H "Content-Type: application/json" \
-d '{
"TaskType": "Thumbnails",
"Priority": 1
}'
```
--------------------------------
### Configure Damselfly with Docker Compose
Source: https://github.com/webreaper/damselfly/blob/master/docs/Installation.md
Define Damselfly service configuration using Docker Compose. This includes image, ports, volume mappings, and restart policy. It's an alternative to the direct docker run command.
```yaml
damselfly:
container_name: damselfly
image: webreaper/damselfly
ports:
- 6363:6363/tcp
volumes:
- /volume1/dockerdata/damselfly:/config
- /volume1/dockerdata/damselfly/thumbs:/thumbs
- /volume1/photo:/pictures
restart: unless-stopped
```
--------------------------------
### Include Default Icon Font Stylesheet
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/css/open-iconic/README.md
Link the default stylesheet for standalone icon font usage.
```html
```
--------------------------------
### Download and Export API
Source: https://context7.com/webreaper/damselfly/llms.txt
APIs for downloading images individually or as ZIP archives, with options for resizing and watermarking. Export configurations can be managed.
```APIDOC
## POST /api/download/images
### Description
Downloads images, optionally as a ZIP archive, with configurable resizing and watermarking.
### Method
POST
### Endpoint
/api/download/images
### Parameters
#### Request Body
- **ImageIds** (array of integer) - Required - List of image IDs to download.
- **Config** (object) - Optional - Configuration for the download.
- **Type** (string) - Optional - Type of export, e.g., "Download".
- **Size** (string) - Optional - Desired image size (e.g., "Large", "Medium").
- **KeepFolders** (boolean) - Optional - Whether to preserve folder structure.
- **WatermarkText** (string) - Optional - Text to use for watermarking.
### Request Example
```json
{
"ImageIds": [1234, 1235, 1236],
"Config": {
"Type": "Download",
"Size": "Large",
"KeepFolders": false,
"WatermarkText": null
}
}
```
### Response
#### Success Response (200)
- **downloadUrl** (string) - URL to the downloaded ZIP archive.
#### Response Example
```json
{ "downloadUrl": "/downloads/export_abc123.zip" }
```
### Notes
Available export sizes: FullRes, ExtraLarge (1920px), Large (1600px), Medium (1024px), Small (800px).
```
```APIDOC
## GET /api/export/configs
### Description
Retrieves a list of saved export configurations.
### Method
GET
### Endpoint
/api/export/configs
```
```APIDOC
## PUT /api/export/config
### Description
Creates a new export configuration.
### Method
PUT
### Endpoint
/api/export/config
### Parameters
#### Request Body
- **Name** (string) - Required - Name of the export configuration.
- **Type** (string) - Required - Type of export (e.g., "Download").
- **Size** (string) - Required - Desired image size.
- **KeepFolders** (boolean) - Required - Whether to preserve folder structure.
- **WatermarkText** (string) - Optional - Text for watermarking.
### Request Example
```json
{
"Name": "Web Export",
"Type": "Download",
"Size": "Medium",
"KeepFolders": true,
"WatermarkText": "Copyright 2023"
}
```
```
```APIDOC
## PATCH /api/export/config
### Description
Updates an existing export configuration.
### Method
PATCH
### Endpoint
/api/export/config
### Parameters
#### Request Body
- **ExportConfigId** (integer) - Required - The ID of the export configuration to update.
- **Name** (string) - Optional - New name for the configuration.
- **Size** (string) - Optional - New desired image size.
### Request Example
```json
{
"ExportConfigId": 1,
"Name": "Web Export Updated",
"Size": "Large"
}
```
```
```APIDOC
## DELETE /api/export/config/{id}
### Description
Deletes a specific export configuration.
### Method
DELETE
### Endpoint
/api/export/config/{id}
### Parameters
#### Path Parameters
- **id** (integer) - Required - The ID of the export configuration to delete.
```
```APIDOC
## GET /api/download/desktopapppaths
### Description
Retrieves paths related to the desktop application for downloads.
### Method
GET
### Endpoint
/api/download/desktopapppaths
```
--------------------------------
### Include Foundation Icon Font Stylesheet
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/css/open-iconic/README.md
Link the Foundation-specific stylesheet for using Open Iconic with Foundation projects.
```html
```
--------------------------------
### Include Bootstrap Icon Font Stylesheet
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/css/open-iconic/README.md
Link the Bootstrap-specific stylesheet to use Open Iconic with Bootstrap projects.
```html
```
--------------------------------
### Folder API
Source: https://context7.com/webreaper/damselfly/llms.txt
Endpoints for browsing and managing the folder hierarchy.
```APIDOC
## GET /api/folders
### Description
Retrieves the entire folder hierarchy.
### Method
GET
### Endpoint
/api/folders
### Response
#### Success Response (200)
- **folderId** (integer) - Unique identifier for the folder.
- **path** (string) - The full path of the folder.
- **parentId** (integer or null) - The ID of the parent folder, or null if it's a root folder.
#### Response Example
```json
[
{ "folderId": 1, "path": "/photos", "parentId": null },
{ "folderId": 2, "path": "/photos/2023", "parentId": 1 },
{ "folderId": 3, "path": "/photos/2023/vacation", "parentId": 2 }
]
```
```
```APIDOC
## GET /api/folders/states/{userId}
### Description
Retrieves the user-specific states (expanded/collapsed) for folders.
### Method
GET
### Endpoint
/api/folders/states/{userId}
### Parameters
#### Path Parameters
- **userId** (integer) - Required - The ID of the user.
```
```APIDOC
## POST /api/folders/state
### Description
Updates the expanded/collapsed state of folders for a user.
### Method
POST
### Endpoint
/api/folders/state
### Parameters
#### Request Body
- An array of folder state objects, each containing:
- **folderId** (integer) - Required - The ID of the folder.
- **userId** (integer) - Required - The ID of the user.
- **isExpanded** (boolean) - Required - The new expanded state (`true` for expanded, `false` for collapsed).
### Request Example
```json
[
{ "folderId": 2, "userId": 1, "isExpanded": true },
{ "folderId": 3, "userId": 1, "isExpanded": false }
]
```
```
--------------------------------
### Move or Copy Images
Source: https://context7.com/webreaper/damselfly/llms.txt
Move or copy specified images to a new destination folder. Set `Move` to `true` for moving and `false` for copying.
```bash
curl -X POST "http://localhost:6363/api/files/move" \
-H "Content-Type: application/json" \
-d '{
"ImageIDs": [1234, 1235, 1236],
"Destination": {
"folderId": 42,
"path": "/photos/2023/vacation"
},
"Move": true
}'
```
```bash
curl -X POST "http://localhost:6363/api/files/move" \
-H "Content-Type: application/json" \
-d '{
"ImageIDs": [1234, 1235],
"Destination": {
"folderId": 43,
"path": "/photos/backup"
},
"Move": false
}'
```
--------------------------------
### Rescan Folder for Thumbnails
Source: https://context7.com/webreaper/damselfly/llms.txt
Initiate a rescan of all images within a specified folder to regenerate thumbnails. Use `ScanType: "Thumbnails"` and provide `FolderId`.
```bash
curl -X POST "http://localhost:6363/api/rescan" \
-H "Content-Type: application/json" \
-d '{
"ScanType": "Thumbnails",
"FolderId": 42
}'
```
--------------------------------
### Authentication API
Source: https://context7.com/webreaper/damselfly/llms.txt
Login and registration endpoints for JWT-based authentication.
```APIDOC
## Authentication API
### Description
Login and registration endpoints for JWT-based authentication.
## POST /api/Login
### Description
Logs in a user and returns a JWT token upon successful authentication.
### Method
POST
### Endpoint
/api/Login
### Request Body
- **Email** (string) - Required - The user's email address.
- **Password** (string) - Required - The user's password.
### Request Example
```json
{
"Email": "user@example.com",
"Password": "password123"
}
```
### Response
#### Success Response (200)
- **successful** (boolean) - Indicates if the login was successful.
- **token** (string) - The JWT token if login is successful.
- **error** (string) - An error message if login fails.
#### Response Example
```json
{
"successful": true,
"token": "eyJhbG...",
"error": null
}
```
#### Failure Response (e.g., 401 Unauthorized)
- **successful** (boolean) - Indicates if the login was successful.
- **token** (string) - Null if login fails.
- **error** (string) - An error message describing the failure (e.g., "Invalid credentials").
#### Response Example
```json
{
"successful": false,
"token": null,
"error": "Invalid credentials"
}
```
## POST /api/Accounts
### Description
Registers a new user account.
### Method
POST
### Endpoint
/api/Accounts
### Request Body
- **Email** (string) - Required - The email address for the new account.
- **Password** (string) - Required - The password for the new account.
- **ConfirmPassword** (string) - Required - The confirmation of the password.
### Request Example
```json
{
"Email": "newuser@example.com",
"Password": "SecurePass123!",
"ConfirmPassword": "SecurePass123!"
}
```
### Response
#### Success Response (200)
(No specific success response details provided in the source text.)
#### Response Example
(No specific success response example provided in the source text.)
```
--------------------------------
### Perform Image Crop
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/index.html
Initializes an image cropper on an element specified by `elementId`. It uses a `Cropper` library and invokes a .NET method `CompleteCrop` with the resulting coordinates upon update.
```javascript
function doImageCrop(elementId, DotNetRef) {
var image = document.getElementById(elementId);
new Cropper(image, {
update: function (coords) {
DotNetRef.invokeMethodAsync("CompleteCrop", { top: coords.y, left: coords.x, width: coords.width, height: coords.height });
}
});
}
```
--------------------------------
### Configure WordPress .htaccess for JWT Authentication
Source: https://github.com/webreaper/damselfly/blob/master/docs/FAQ.md
Add these lines to your .htaccess file to enable JWT authentication for the WordPress REST API, which is required for Damselfly integration. This ensures that authorization headers are passed correctly.
```apache
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
```
--------------------------------
### Task Management API
Source: https://context7.com/webreaper/damselfly/llms.txt
APIs for viewing and managing scheduled background tasks.
```APIDOC
## GET /api/tasks
### Description
Retrieves a list of all scheduled background tasks.
### Method
GET
### Endpoint
/api/tasks
### Response
#### Success Response (200)
- **taskId** (integer) - The unique ID of the task.
- **taskType** (string) - The type of task (e.g., "Indexing", "AIProcessing").
- **status** (string) - The current status of the task (e.g., "Running", "Pending").
#### Response Example
```json
[
{ "taskId": 1, "taskType": "Indexing", "status": "Running", ... },
{ "taskId": 2, "taskType": "AIProcessing", "status": "Pending", ... }
]
```
```
--------------------------------
### User Management API
Source: https://context7.com/webreaper/damselfly/llms.txt
Manage users and roles for multi-user authentication.
```APIDOC
## User Management API
### Description
Manage users and roles for multi-user authentication. Supports creating users, updating passwords, and assigning roles.
## GET /api/users
### Description
Retrieves a list of all users.
### Method
GET
### Endpoint
/api/users
## GET /api/user/{id}
### Description
Retrieves a specific user by their ID.
### Method
GET
### Endpoint
/api/user/{id}
### Parameters
#### Path Parameters
- **id** (integer) - Required - The ID of the user to retrieve.
## GET /api/users/roles
### Description
Retrieves a list of all available roles.
### Method
GET
### Endpoint
/api/users/roles
## PUT /api/users
### Description
Creates a new user.
### Method
PUT
### Endpoint
/api/users
### Request Body
- **UserName** (string) - Required - The username for the new user.
- **Email** (string) - Required - The email address for the new user.
- **Password** (string) - Required - The password for the new user.
- **Roles** (array of strings) - Optional - A list of roles to assign to the new user.
### Request Example
```json
{
"UserName": "newuser",
"Email": "newuser@example.com",
"Password": "SecurePass123!",
"Roles": ["User", "Editor"]
}
```
## POST /api/users (Update Roles)
### Description
Updates the roles for an existing user.
### Method
POST
### Endpoint
/api/users
### Request Body
- **UserName** (string) - Required - The username of the user whose roles are to be updated.
- **Email** (string) - Required - The email address of the user.
- **Roles** (array of strings) - Required - The new list of roles to assign to the user.
### Request Example
```json
{
"UserName": "existinguser",
"Email": "user@example.com",
"Roles": ["User", "Admin"]
}
```
## POST /api/users (Update Password)
### Description
Updates the password for an existing user.
### Method
POST
### Endpoint
/api/users
### Request Body
- **UserName** (string) - Required - The username of the user whose password is to be updated.
- **Password** (string) - Required - The new password for the user.
### Request Example
```json
{
"UserName": "existinguser",
"Password": "NewSecurePass456!"
}
```
### Response
#### Success Response (200)
(No specific success response details provided for these endpoints in the source text.)
#### Response Example
(No specific success response examples provided for these endpoints in the source text.)
```
--------------------------------
### Download File via Location Change
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/index.html
Triggers a file download by changing the browser's location to the specified filename. This is a common method for initiating downloads of pre-generated files.
```javascript
function downloadFile(filename) {
location.href = filename;
}
```
--------------------------------
### Copy Images Between Baskets
Source: https://context7.com/webreaper/damselfly/llms.txt
Duplicates images from a source basket to a destination basket. Requires SourceBasketId and DestBasketId.
```bash
curl -X POST "http://localhost:6363/api/basket/copy" \
-H "Content-Type: application/json" \
-d '{
"SourceBasketId": 5,
"DestBasketId": 6
}'
```
--------------------------------
### Image Retrieval API
Source: https://context7.com/webreaper/damselfly/llms.txt
Retrieve image metadata, thumbnails in various sizes, and full-resolution images. Supports batch retrieval and downloading with original filenames.
```bash
# Get single image metadata
curl "http://localhost:6363/api/image/1234"
```
```bash
# Batch retrieve multiple images
curl -X POST "http://localhost:6363/api/images/batch" \
-H "Content-Type: application/json" \
-d '{
"ImageIds": [1234, 1235, 1236, 1237, 1238]
}'
```
```bash
# Get thumbnail (sizes: Small, Preview, Medium, Big, Large, ExtraLarge)
curl "http://localhost:6363/thumb/Medium/1234" --output thumb.jpg
```
```bash
# Get raw full-resolution image
curl "http://localhost:6363/rawimage/1234" --output image.jpg
```
```bash
# Download image with original filename
curl "http://localhost:6363/dlimage/1234" --output image.jpg
```
```bash
# Get face thumbnail for a person
curl "http://localhost:6363/face/15" --output face.jpg
```
--------------------------------
### Update Export Configuration
Source: https://context7.com/webreaper/damselfly/llms.txt
Modify an existing export configuration by providing its ID and the fields to update.
```bash
curl -X PATCH "http://localhost:6363/api/export/config" \
-H "Content-Type: application/json" \
-d '{
"ExportConfigId": 1,
"Name": "Web Export Updated",
"Size": "Large"
}'
```
--------------------------------
### Task Enqueue API
Source: https://context7.com/webreaper/damselfly/llms.txt
Enqueue new tasks for processing.
```APIDOC
## POST /api/tasks/enqueue
### Description
Enqueues a new task for processing.
### Method
POST
### Endpoint
/api/tasks/enqueue
### Request Body
- **TaskType** (string) - Required - The type of task to enqueue (e.g., "Thumbnails").
- **Priority** (integer) - Optional - The priority of the task (higher value means higher priority).
### Request Example
```json
{
"TaskType": "Thumbnails",
"Priority": 1
}
```
### Response
#### Success Response (200)
(No specific success response details provided in the source text.)
#### Response Example
(No specific success response example provided in the source text.)
```
--------------------------------
### Add/Remove Images from Basket
Source: https://context7.com/webreaper/damselfly/llms.txt
Updates the contents of a basket by adding or removing images. Set NewState to true to add, false to remove. Requires BasketId and ImageIds.
```bash
curl -X POST "http://localhost:6363/api/basketimage/state" \
-H "Content-Type: application/json" \
-d '{
"BasketId": 5,
"ImageIds": [1234, 1235, 1236],
"NewState": true
}'
```
--------------------------------
### Search People by Name
Source: https://context7.com/webreaper/damselfly/llms.txt
Finds people whose names match a given search string. Useful for locating individuals.
```bash
curl "http://localhost:6363/api/people/names/John"
```
--------------------------------
### Validate URL and Save Settings in Damselfly Desktop
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Desktop/index.html
Handles URL validation and saving of application settings. The URL is validated before saving.
```javascript
window.validate = function() { urlVal = document.getElementById("url").value; document.getElementById('saveBtn').disabled = invalidUrl(urlVal); }
window.saveSettings = function() { urlVal = document.getElementById("url").value; folderVal = document.getElementById("folder").value; saveConfig(urlVal, folderVal); }
```
--------------------------------
### Use Foundation Icon Font
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/css/open-iconic/README.md
Use the 'fi-icon-name' class on span elements for Foundation integration. Include title and aria-hidden attributes.
```html
```
--------------------------------
### Resume Background Work
Source: https://context7.com/webreaper/damselfly/llms.txt
Resume background processing by setting the 'paused' query parameter to false.
```bash
curl -X POST "http://localhost:6363/api/work/pause?paused=false"
```
--------------------------------
### Add and Remove Tags from Images
Source: https://context7.com/webreaper/damselfly/llms.txt
Manages tags for a list of images, allowing addition of new tags and removal of existing ones in a single request. Requires ImageIDs, TagsToAdd, TagsToDelete, and UserId.
```bash
curl -X POST "http://localhost:6363/api/tags" \
-H "Content-Type: application/json" \
-d '{
"ImageIDs": [1234, 1235, 1236],
"TagsToAdd": ["vacation", "beach", "summer"],
"TagsToDelete": ["untagged"],
"UserId": 1
}'
```
--------------------------------
### Increase MacOS File Watcher Limit
Source: https://github.com/webreaper/damselfly/blob/master/docs/Installation.md
Set the maximum number of file descriptors for the MacOS system. This command adjusts the kern.maxfiles setting, which can be relevant for applications that monitor many files.
```bash
sudo sysctl -w kern.maxfiles=524288
```
--------------------------------
### Search Images API
Source: https://context7.com/webreaper/damselfly/llms.txt
Perform full-text searches with extensive filtering options including date ranges, tags, people, folders, metadata, file size, and orientation. Results are paginated and return image IDs.
```bash
# Search for images with text query
curl -X POST "http://localhost:6363/api/search" \
-H "Content-Type: application/json" \
-d '{
"Query": {
"SearchText": "vacation beach",
"TagsOnly": false,
"IncludeAITags": true,
"IncludeChildFolders": true,
"MinDate": "2023-01-01T00:00:00Z",
"MaxDate": "2023-12-31T23:59:59Z",
"SortOrder": "Descending",
"Grouping": "None"
},
"First": 0,
"Count": 50
}'
```
```bash
# Search by folder with minimum rating
curl -X POST "http://localhost:6363/api/search" \
-H "Content-Type: application/json" \
-d '{
"Query": {
"FolderId": 42,
"IncludeChildFolders": true,
"MinRating": 3,
"Orientation": "Landscape"
},
"First": 0,
"Count": 100
}'
```
```bash
# Search by person
curl -X POST "http://localhost:6363/api/search" \
-H "Content-Type: application/json" \
-d '{
"Query": {
"PersonId": 15,
"FaceSearch": "Identified"
},
"First": 0,
"Count": 50
}'
```
```bash
# Search untagged images
curl -X POST "http://localhost:6363/api/search" \
-H "Content-Type: application/json" \
-d '{
"Query": {
"UntaggedImages": true,
"MinSizeKB": 100,
"MaxSizeKB": 50000
},
"First": 0,
"Count": 50
}'
```
--------------------------------
### Update Folder States
Source: https://context7.com/webreaper/damselfly/llms.txt
Modifies the view state of folders for a user, setting whether they are expanded or collapsed. Accepts an array of folder state objects.
```bash
curl -X POST "http://localhost:6363/api/folders/state" \
-H "Content-Type: application/json" \
-d '[
{ "folderId": 2, "userId": 1, "isExpanded": true },
{ "folderId": 3, "userId": 1, "isExpanded": false }
]'
```
--------------------------------
### Update Person Name
Source: https://context7.com/webreaper/damselfly/llms.txt
Changes the name of a person. Set Merge to false to simply update the name. Requires PersonId and NewName.
```bash
curl -X PUT "http://localhost:6363/api/people/name" \
-H "Content-Type: application/json" \
-d '{
"PersonId": 2,
"NewName": "Jane Smith",
"Merge": false
}'
```
--------------------------------
### Display SVG Icon
Source: https://github.com/webreaper/damselfly/blob/master/Damselfly.Web.Client/wwwroot/css/open-iconic/README.md
Use this method to display individual SVG icons. Ensure to include an alt attribute for accessibility.
```html
```
--------------------------------
### Rescan All Images for AI Processing
Source: https://context7.com/webreaper/damselfly/llms.txt
Perform AI processing on all images in the library. Set `ScanType` to `AI` and `RescanAll` to `true`.
```bash
curl -X POST "http://localhost:6363/api/rescan" \
-H "Content-Type: application/json" \
-d '{
"ScanType": "AI",
"RescanAll": true
}'
```
--------------------------------
### Work Service API
Source: https://context7.com/webreaper/damselfly/llms.txt
Control background processing, including pausing/resuming and CPU scheduling.
```APIDOC
## Work Service API
### Description
Control background processing including pausing/resuming and CPU scheduling settings for balancing performance with system resources.
## GET /api/work/status
### Description
Gets the current status of background work processing.
### Method
GET
### Endpoint
/api/work/status
## POST /api/work/pause
### Description
Pauses or resumes background work.
### Method
POST
### Endpoint
/api/work/pause
### Query Parameters
- **paused** (boolean) - Required - Set to `true` to pause, `false` to resume.
## GET /api/work/settings
### Description
Gets the current CPU scheduling settings for background work.
### Method
GET
### Endpoint
/api/work/settings
## POST /api/work/settings
### Description
Sets the CPU scheduling settings for background work.
### Method
POST
### Endpoint
/api/work/settings
### Request Body
- **dayTimeLevel** (integer) - Optional - CPU level during daytime.
- **nightTimeLevel** (integer) - Optional - CPU level during nighttime.
- **nightStartHour** (integer) - Optional - The hour when nighttime scheduling begins (24-hour format).
- **nightEndHour** (integer) - Optional - The hour when nighttime scheduling ends (24-hour format).
### Request Example
```json
{
"dayTimeLevel": 2,
"nightTimeLevel": 4,
"nightStartHour": 22,
"nightEndHour": 6
}
```
### Response
#### Success Response (200)
(No specific success response details provided for these endpoints in the source text.)
#### Response Example
(No specific success response examples provided for these endpoints in the source text.)
```
--------------------------------
### Increase Linux INotify Watcher Limit
Source: https://github.com/webreaper/damselfly/blob/master/docs/Installation.md
Adjust the maximum number of inotify instances for the Linux kernel. This command appends a setting to sysctl.conf and applies it, necessary for file watchers in applications like Damselfly.
```bash
echo fs.inotify.max_user_instances=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
```
--------------------------------
### Rescan Images for Metadata
Source: https://context7.com/webreaper/damselfly/llms.txt
Trigger a rescan of specific images to extract or update metadata. Ensure the `ScanType` is set to `Metadata`.
```bash
curl -X POST "http://localhost:6363/api/rescan" \
-H "Content-Type: application/json" \
-d '{
"ScanType": "Metadata",
"ImageIds": [1234, 1235, 1236]
}'
```