Skip to content

REST API

Attachments: 12 routes.

All under /wp-json/davo/v1. Every route has a description in the source.

  • GET4
  • POST7
  • PUT1
  • PATCH1
  • DELETE1

/attachments

POSTAccess check: require_login

POST /attachments - upload a single file as a temporary attachment.

Handler: cb_upload()

Parameters of POST /attachments
ParameterTypeRequiredDefault or allowed values
target_typestringYes—
target_idintegerNo0
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments" \
  -H "Content-Type: application/json" \
  -d '{"target_type": "…"}'

GETPublic

GET /attachments?target_type=&target_id= - list committed attachments for a target.

Handler: cb_list_for_target()

Parameters of GET /attachments
ParameterTypeRequiredDefault or allowed values
target_typestringYes—
target_idintegerYes—
curl
curl "https://example.com/wp-json/davo/v1/attachments?target_type=…&target_id=1"

src/domains/attachments/routes.php:286

/attachments/{id}

DELETEAccess check: require_login

DELETE /attachments/{id} - remove a temporary or committed attachment.

Handler: cb_remove()

Parameters of DELETE /attachments/{id}
ParameterTypeRequiredDefault or allowed values
idintegerYes—
curl
curl -X DELETE -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/{id}"

src/domains/attachments/routes.php:355

/attachments/{id}/download

GETPublic

GET /attachments/{id}/download - stream a committed attachment's file after re-validating access, rather than exposing a bare public URL.

Handler: cb_download()

Parameters of GET /attachments/{id}/download
ParameterTypeRequiredDefault or allowed values
idintegerYes—
curl
curl "https://example.com/wp-json/davo/v1/attachments/{id}/download"

src/domains/attachments/routes.php:372

/attachments/{id}/preview

GETPublic

GET /attachments/{id}/preview?expires=&size=&sig= - stream an attachment inline for display (image url/thumbnail_url in Attachments_Helpers::build_response()), gated first by the signed, expiring link parameters and then by the same live permission check cb_download() uses. Replaces exposing a bare, permanent wp_get_attachment_url() link for attachment previews.

Handler: cb_preview()

Parameters of GET /attachments/{id}/preview
ParameterTypeRequiredDefault or allowed values
idintegerYes—
expiresintegerYes—
sizestringYesfull | thumbnail
sigstringYes—
curl
curl "https://example.com/wp-json/davo/v1/attachments/{id}/preview?expires=1&size=full&sig=…"

src/domains/attachments/routes.php:389

/attachments/commit

POSTAccess check: require_login

Called explicitly by the consuming domain's frontend right after its own create/update request succeeds - see Questions_Attachments_Integration's class docblock for why this is a separate, explicit call rather than something inferred from a Questions lifecycle hook.

Handler: cb_commit()

Parameters of POST /attachments/commit
ParameterTypeRequiredDefault or allowed values
attachment_idsarrayYes—
target_typestringYes—
target_idintegerYes—
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/commit" \
  -H "Content-Type: application/json" \
  -d '{"attachment_ids": [], "target_type": "…", "target_id": 1}'

src/domains/attachments/routes.php:328

/attachments/storage/migrate-local

POSTAccess check: require_storage_admin

POST /attachments/storage/migrate-local - move a batch of local-only files.

Handler: cb_storage_migrate_local()

Parameters of POST /attachments/storage/migrate-local
ParameterTypeRequiredDefault or allowed values
batchinteger—5
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/storage/migrate-local"

src/domains/attachments/routes.php:146

/attachments/storage/oauth/disconnect

POSTAccess check: require_storage_admin

POST /attachments/storage/oauth/disconnect - forget the authorization.

Handler: cb_storage_oauth_disconnect()

Parameters of POST /attachments/storage/oauth/disconnect
ParameterTypeRequiredDefault or allowed values
providerstringYes—
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/storage/oauth/disconnect" \
  -H "Content-Type: application/json" \
  -d '{"provider": "…"}'

src/domains/attachments/routes.php:129

/attachments/storage/oauth/start

POSTAccess check: require_storage_admin

POST /attachments/storage/oauth/start - returns the provider consent URL.

Handler: cb_storage_oauth_start()

Parameters of POST /attachments/storage/oauth/start
ParameterTypeRequiredDefault or allowed values
providerstringYes—
return_urlstringYes—
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/storage/oauth/start" \
  -H "Content-Type: application/json" \
  -d '{"provider": "…", "return_url": "…"}'

src/domains/attachments/routes.php:107

/attachments/storage/retry-failed

POSTAccess check: require_storage_admin

POST /attachments/storage/retry-failed - re-queue failed pushes.

Handler: cb_storage_retry_failed()

No parameters declared in the route registration.

curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/storage/retry-failed"

src/domains/attachments/routes.php:164

/attachments/storage/secret

PUTPATCHAccess check: require_storage_admin

PUT /attachments/storage/secret - write-only; the secret is never returned by any endpoint. An empty value clears it.

Handler: cb_storage_secret()

Parameters of PUT/PATCH /attachments/storage/secret
ParameterTypeRequiredDefault or allowed values
secretstringYes—
providerstring—s3
curl
curl -X PUT -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/storage/secret" \
  -H "Content-Type: application/json" \
  -d '{"secret": "…"}'

src/domains/attachments/routes.php:86

/attachments/storage/status

GETAccess check: require_storage_admin

GET /attachments/storage/status - counts per storage state.

Handler: cb_storage_status()

No parameters declared in the route registration.

curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/storage/status"

src/domains/attachments/routes.php:59

/attachments/storage/test

POSTAccess check: require_storage_admin

POST /attachments/storage/test - round-trip check of a driver.

Handler: cb_storage_test()

Parameters of POST /attachments/storage/test
ParameterTypeRequiredDefault or allowed values
driverstringYes—
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/attachments/storage/test" \
  -H "Content-Type: application/json" \
  -d '{"driver": "…"}'

src/domains/attachments/routes.php:69

Note. Generated from the plugin source. Parameters are the ones declared when the route is registered; a parameter marked “see source” uses a shared definition. Responses are not documented here. Authenticate as for any WordPress REST route, for example with an application password over HTTPS; the example paths use https://example.com.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first