Skip to main content

Change an episode’s workflow status, outline or recording over REST

Premium Advanced Podcast Workflow

Three routes: PUT /benecaster-podcast-workflow/v1/shows/{show_id}/episodes/{episode_id}/workflow-status, PUT …/outline and PUT …/recording.

Access. The same permission and per-show checks as Read the Podcast Workflow Workbench over REST: benecaster_rest_permission_admin, then 404 benecaster_podcast_workflow_show_not_found, 403 benecaster_podcast_workflow_off_for_show, 404 benecaster_podcast_workflow_episode_not_found (trashed or missing) and 409 benecaster_podcast_workflow_other_show for another show’s episode, which is never changed. Each route answers 200 with the episode’s refreshed canvas, as GET …/workbench does.

  • PUT …/workflow-status sends { status }: draft, review or approved. Anything else is 400 benecaster_podcast_workflow_invalid_status. An episode that is scheduled or published takes its status from the episode: 409 benecaster_podcast_workflow_status_from_episode. A change fires the status hooks in Run your own code when an episode’s workflow status, recording or outline changes in Podcast Workflow.
  • PUT …/outline sends { outline, final }: the outline as plain text (a blank line starts a paragraph, a single line break is kept) and final as true or false. It is stored as <p> paragraphs in _benecaster_workflow_outline. Over 100,000 characters is 400 benecaster_podcast_workflow_outline_too_long; a missing or non-boolean field is 400 benecaster_podcast_workflow_invalid_field.
  • PUT …/recording sends { complete } as true or false (else 400 benecaster_podcast_workflow_invalid_field).

Code

<?php
$request = new WP_REST_Request( 'PUT', '/benecaster-podcast-workflow/v1/shows/42/episodes/1234/workflow-status' );
$request->set_body_params( [ 'status' => 'review' ] );
$canvas = rest_do_request( $request )->get_data(); // $canvas['workflow']['status'] === 'review'

View on GitHub →

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