Read the Podcast Workflow Workbench over REST
Two routes: GET /benecaster-podcast-workflow/v1/shows/{show_id}/episodes and GET …/shows/{show_id}/episodes/{episode_id}/workbench.
Access. Both need manage_options and the REST nonce (benecaster_rest_permission_admin), then refuse a show that does not exist (404 benecaster_podcast_workflow_show_not_found) or has Podcast Workflow off (403 benecaster_podcast_workflow_off_for_show).
GET …/shows/{show_id}/episodes answers { episodes: [row] }: the show’s episodes in production, which are its draft and scheduled episodes (published, private and trashed ones are left out), scheduled first (soonest first), then drafts (newest first). A row is { id, title, post_status, workflow_status, date_label, stage, done, total, tasks }:
workflow_statusisdraft,review,approved,scheduledorpublished(see Run your own code when an episode’s workflow status, recording or outline changes in Podcast Workflow).date_labelis a scheduled episode’s date in the site’s date format and time zone,''otherwise.stageis the first stage, left to right, holding a tile that is not done (publishwhen every tile is done,pre-productionwhen there are none).doneandtotalcount the episode’s drawn tiles.tasksis the episode’s production plan in figures,{ total, complete, late, blocked, finalised, next: { id, name, offset_days, due_date, late } | null }, or null when the episode has no plan (see Read and set the status of a task in an episode’s production plan, and run code when one changes).
GET …/episodes/{episode_id}/workbench answers { episode: row, tiles: [tile], workflow } for any episode of the show that is not trashed, published ones included. episode is the row above, tasks included.
workflowis what Podcast Workflow’s own tiles edit:{ status, settable, outline, outline_final, recording_complete, guest_preparation, subscriber_notification, sponsor_confirmation, transcription }.settableis false while the episode is scheduled or published.outlineis the outline as plain text; it is internal, and only ever sent on this admin-only route.- The four partner-tile panels in
workflow:guest_preparation:{ guest_manager, guests: [ { id, name, record_url } ], prepared, notes, edit_guests_url }(see Read or save an episode’s Guest preparation, and run code when it is saved).subscriber_notification:{ email_editor, choice, choice_label, notified, notes, editor_url }(see Read or save an episode’s Subscriber notification, and run code when it is saved).sponsor_confirmation:{ confirmed, notes }(see Read or save an episode’s Sponsor confirmation notes, and run code when they are saved).transcription:{ transcription, status, status_label, error, can_request, editor_url, done, notes }(see Read an episode’s Transcription tile, save its notes, and run code when they are saved).
- The writes in Change an episode’s workflow status, outline or recording over REST and the four partner-tile saves answer this same canvas.
- A tile is its definition and its state together:
{ id, label, stage, priority, add_on, partner_active, status, summary, count, action_url, action_label }(see Put a tile on the Podcast Workflow Workbench, and say where it stands for each episode). - A trashed or missing episode is
404 benecaster_podcast_workflow_episode_not_found. - An episode of another show is
409 benecaster_podcast_workflow_other_show, withdata.episode_id,data.episode_show_idanddata.episode_show_title, and none of its tiles: one show’s episode is never read through another show’s route.
Code
<?php
$request = new WP_REST_Request( 'GET', '/benecaster-podcast-workflow/v1/shows/42/episodes/1234/workbench' );
$response = rest_do_request( $request );
if ( 409 === $response->get_status() ) {
$home = $response->get_data()['data']['episode_show_id']; // ask again under that show
}
Need this built rather than just documented? See our services →