Files
lua-scripts-w-api/contrib/darktable-api/bruno/images/Refresh Cache.bru
stephen schuresko bd40b4f850 Add darktable REST API implementation
- Introduced a new Lua-based REST API for darktable, allowing external applications to interact with the darktable library.
- Implemented core functionalities including image listing, retrieval, and preview serving.
- Added support for OAuth 2.0 authentication with token generation.
- Created a simple HTTP router to handle API requests.
- Included JSON encoding/decoding utilities for API responses.
- Developed a script to launch the API server alongside darktable, ensuring seamless integration.
- Added necessary configuration and setup for the API server, including CORS support and error handling.
2026-06-10 15:02:19 -04:00

50 lines
1.0 KiB
Plaintext

meta {
name: Refresh Cache
type: http
seq: 5
}
post {
url: {{baseUrl}}/api/v1/images/{{imageId}}/refresh
body: none
auth: bearer
}
auth:bearer {
token: {{accessToken}}
}
tests {
test("returns 202 Accepted", function() {
expect(res.status).to.equal(202);
});
test("status is accepted", function() {
expect(res.body.status).to.equal("accepted");
});
test("image_id matches request", function() {
expect(res.body.image_id).to.equal(Number(bru.getVar("imageId")));
});
test("has filename", function() {
expect(res.body.filename).to.be.a("string");
});
test("has queue path", function() {
expect(res.body.queue).to.be.a("string");
});
}
docs {
## Refresh Cache
Enqueues the image for thumbnail regeneration inside the running darktable instance.
Returns **202 Accepted** immediately. The darktable bridge plugin
(`darktable-api-bridge.lua`) polls `/tmp/dt-api-refresh.queue` every second
and calls `image:drop_cache()` + `image:generate_cache()` when it finds this ID.
Requires scope: `cache:refresh`
}