Artist Permissions Endpoint
Route
GET /wp-json/extrachill/v1/artists/{id}/permissions
Purpose
Tells extrachill.link whether the logged-in user can edit a specific artist profile, powering the client-side "Edit" button.
Request Parameters
| Field | Type | Required | Notes |
|---|---|---|---|
id |
integer | Yes | Artist profile post ID (in URL path) |
Response
{
"can_edit": true,
"manage_url": "https://artist.extrachill.com/manage-link-page/",
"user_id": 45
}
can_editbecomestruewhenec_can_manage_artist( current_user_id, artist_id )returns true.manage_urlpoints to the artist management screen for link pages (empty string when unauthorized).
CORS Behavior
- If the request originates from
https://extrachill.link, the endpoint injects:Access-Control-Allow-Origin: https://extrachill.linkAccess-Control-Allow-Credentials: true
so frontend fetches can include cookies.
File
inc/routes/artists/permissions.php
Usage Notes
- Authentication relies on WordPress cookies; ensure the cross-domain cookie helper is active.
- Permission logic is delegated to the shared helper
ec_can_manage_artist()which must be available in the network.