Skip to main content

Read the Podcast Workflow Workbench over REST

Premium Advanced Podcast Workflow

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 }:

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.

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
}

View on GitHub →

Need this built rather than just documented? See our services →