Description
This endpoint allows you to retrieve all steps of the workflow for the specified entry.
Authentication
For details on the methods available to authenticate to the API, refer to this REST API v2 Authentication guide.
This endpoint requires the gravityflow_create_steps capability. This can be adjusted using gravityflow_rest_api_capability_get_forms_steps filter
Using the Endpoint
Path and Method
GET /wp-json/gf/v2/entries/[entry_id]/workflow/steps
The path must include the specific entry ID that you wish to get the steps for.
Request Parameters
There are no required or optional properties for this endpoint.
Response
Success
A successful response will contain an JSON array of Workflow Steps Objects of steps in the forms workflow.
Failure
A failed response will provide a JSON string of the error code and message.
| Key | Type | Description |
|---|---|---|
| code | string | Error code. |
| message | string | Human-readable error message. |
| data[status] | integer | HTTP response status code |
There are several failure scenarios which could be returned depending on request data provided.
| Response Code and data[status] | Error Code | Message | Details |
|---|---|---|---|
| 401 / 403 | permission_denied | You are not allowed to view steps. | User does not have the required permissions for this endpoint. |
| 404 | entry_not_found | Invalid entry id. Entry could not be found. | Could not find an entry with the specified entry_id. |
Examples
PHP Request
//Update these variables
$entry_id = '1273';
$domain = 'https://develop.local';
$auth_value = 'Basic replace-me-with-basic-auth-based-on-user-application-password';
// {@see https://codex.wordpress.org/HTTP_API}
$response = wp_remote_post( $domain . '/wp-json/gf/v2/entries/' . $entry_id . '/workflow/steps', array(
'headers' => array(
'Authorization' => $auth_value,
),
) );
if ( ! is_wp_error( $response ) ) {
// The request went through successfully, check the response code against
// what we're expecting
if ( 200 == wp_remote_retrieve_response_code( $response ) ) {
// Do something with the response
// $body = wp_remote_retrieve_body( $response );
// $headers = wp_remote_retrieve_headers( $response );
} else {
// The response code was not what we were expecting, record the message
$error_message = wp_remote_retrieve_response_message( $response );
}
} else {
// There was an error making the request
$error_message = $response->get_error_message();
}
API Response
[
{
"id": 121,
"type": "workflow_start",
"label": "Start",
"name": "Start",
"is_active": true,
"entry_count": 0,
"supports_expiration": false,
"assignees": [],
"settings": {
"step_name": "Start",
"description": "",
"step_type": "workflow_start",
"feed_condition_conditional_logic": "0",
"feed_condition_conditional_logic_object": [],
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_before_after": "after",
"schedule_date_field_offset": "0",
"schedule_date_field_offset_unit": "hours",
"instructionsEnable": "0",
"instructionsValue": "",
"display_fields_mode": "all_fields",
"destination_complete": "next",
"_entry_count": 0
}
},
{
"id": 123,
"type": "webhook",
"label": "Outgoing Webhook",
"name": "GET Star Wars Spaceships\/Vehicles",
"is_active": true,
"entry_count": 0,
"supports_expiration": false,
"assignees": [],
"settings": {
"step_name": "GET Star Wars Spaceships\/Vehicles",
"description": "",
"step_type": "webhook",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic_object": {
"conditionalLogic": {
"actionType": "show",
"logicType": "any",
"rules": [
{
"fieldId": "1",
"operator": "is",
"value": "starships"
},
{
"fieldId": "1",
"operator": "is",
"value": "vehicles"
}
]
}
},
"feed_condition_conditional_logic": "1",
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"url": "https:\/\/swapi.dev\/api\/{I need details about...:1}\/?search={Search Term:3}",
"method": "get",
"authentication": "",
"basic_username": "",
"basic_password": "",
"connected_app": "",
"requestHeaders": [
{
"key": "",
"custom_key": "",
"value": "",
"custom_value": ""
}
],
"body": "select",
"raw_body": "",
"format": "json",
"body_type": "all_fields",
"mappings": [
{
"key": "gf_custom",
"custom_key": "",
"value": "",
"custom_value": ""
}
],
"response_body": "select_fields",
"response_mappings": [
{
"key": "gf_custom",
"custom_key": "results\\0\\name",
"value": "6",
"custom_value": ""
},
{
"key": "gf_custom",
"custom_key": "results\\0\\model",
"value": "8",
"custom_value": ""
},
{
"key": "gf_custom",
"custom_key": "results\\0\\manufacturer",
"value": "7",
"custom_value": ""
},
{
"key": "gf_custom",
"custom_key": "results\\0\\crew",
"value": "11",
"custom_value": ""
},
{
"key": "gf_custom",
"custom_key": "results\\0\\passengers",
"value": "12",
"custom_value": ""
},
{
"key": "gf_custom",
"custom_key": "results\\0\\url",
"value": "13",
"custom_value": ""
}
],
"destination_complete": "next",
"destination_error_client": "complete",
"destination_error_server": "complete",
"destination_error": "complete",
"highlight": "",
"condition": "",
"_entry_count": 0
}
},
{
"id": 127,
"type": "approval",
"label": "Approval",
"name": "Perform another search?",
"is_active": true,
"entry_count": 2,
"supports_expiration": true,
"assignees": [
{
"key": "role|administrator",
"id": "administrator",
"type": "role",
"display_name": "administrator",
"status": false
}
],
"settings": {
"step_name": "Perform another search?",
"description": "",
"step_type": "approval",
"step_highlight": "0",
"step_highlight_type": "color",
"step_highlight_color": "#dd3333",
"feed_condition_conditional_logic_object": [],
"feed_condition_conditional_logic": "0",
"scheduled": "0",
"schedule_type": "delay",
"schedule_date": "",
"schedule_delay_offset": "",
"schedule_delay_unit": "hours",
"schedule_date_field_offset": "",
"schedule_date_field_offset_unit": "hours",
"schedule_date_field_before_after": "after",
"type": "select",
"assignees": [
"role|administrator"
],
"editable_fields": [
"1",
"3"
],
"routing": "",
"assignee_policy": "any",
"instructionsEnable": "1",
"instructionsValue": "<strong>Approve<\/strong> = Perform another search.\r\n<strong>Reject<\/strong> = You are a now a Jedi master.\r\n\r\nCan't spell for bantha fodder?\r\n<ul><li><strong>People<\/strong>: R2-D2 or Luke Skywalker<\/li><li><strong>Planet<\/strong>: Tatooine or Hoth<\/li><li><strong>Starships<\/strong>: Star Destroyer or Millennium Falcon<\/li><li><strong>Vehicle<\/strong>: AT-AT or snowspeeder<\/li><\/ul>",
"display_fields_mode": "all_fields",
"confirmation_prompt": "0",
"conditional_logic_editable_fields_enabled": "1",
"revertEnable": "0",
"assignee_notification_enabled": "0",
"assignee_notification_from_name": "",
"assignee_notification_from_email": "{admin_email}",
"assignee_notification_reply_to": "",
"assignee_notification_cc": "",
"assignee_notification_bcc": "",
"assignee_notification_subject": "",
"assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.",
"assignee_notification_disable_autoformat": "0",
"resend_assignee_emailEnable": "0",
"resend_assignee_emailValue": "7",
"resend_assignee_email_repeatEnable": "0",
"resend_assignee_email_repeatValue": "3",
"rejection_notification_enabled": "0",
"rejection_notification_type": "select",
"rejection_notification_routing": [
{
"assignee": "user_id|11",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"rejection_notification_from_name": "",
"rejection_notification_from_email": "{admin_email}",
"rejection_notification_reply_to": "",
"rejection_notification_cc": "",
"rejection_notification_bcc": "",
"rejection_notification_subject": "",
"rejection_notification_message": "Entry {entry_id} has been rejected",
"rejection_notification_disable_autoformat": "0",
"approval_notification_enabled": "0",
"approval_notification_type": "select",
"approval_notification_routing": [
{
"assignee": "user_id|11",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"approval_notification_from_name": "",
"approval_notification_from_email": "{admin_email}",
"approval_notification_reply_to": "",
"approval_notification_cc": "",
"approval_notification_bcc": "",
"approval_notification_subject": "",
"approval_notification_message": "Entry {entry_id} has been approved",
"approval_notification_disable_autoformat": "0",
"revert_notification_enabled": "0",
"revert_notification_type": "select",
"revert_notification_routing": [
{
"assignee": "user_id|11",
"fieldId": "0",
"operator": "is",
"value": "",
"type": ""
}
],
"revert_notification_from_name": "",
"revert_notification_from_email": "{admin_email}",
"revert_notification_reply_to": "",
"revert_notification_cc": "",
"revert_notification_bcc": "",
"revert_notification_subject": "",
"revert_notification_message": "Entry {entry_id} has been reverted",
"revert_notification_disable_autoformat": "0",
"note_mode": "not_required",
"approved_messageEnable": "0",
"approved_messageValue": "Entry Approved",
"reverted_messageEnable": "0",
"reverted_messageValue": "Entry Reverted",
"rejected_messageEnable": "0",
"rejected_messageValue": "Entry Rejected",
"processed_step_messageEnable": "0",
"processed_step_messageValue": "This link is no longer valid.",
"due_date": "0",
"due_date_type": "delay",
"due_date_date": "",
"due_date_delay_offset": "",
"due_date_delay_unit": "hours",
"due_date_date_field_offset": "",
"due_date_date_field_offset_unit": "hours",
"due_date_date_field_before_after": "after",
"due_date_highlight_type": "color",
"due_date_highlight_color": "#dd3333",
"expiration": "0",
"expiration_type": "delay",
"expiration_date": "",
"expiration_delay_offset": "",
"expiration_delay_unit": "hours",
"expiration_date_field_offset": "",
"expiration_date_field_offset_unit": "hours",
"expiration_date_field_before_after": "after",
"status_expiration": "rejected",
"destination_expired": "next",
"destination_rejected": "complete",
"destination_approved": "121",
"highlight": "",
"condition": "",
"instructions": "",
"display_fields": "",
"revert": "",
"notification_tabs": "",
"approved_message": "",
"reverted_message": "",
"rejected_message": "",
"processed_step_message": "",
"_entry_count": 2
}
}
]
Since
This endpoint was added in Gravity Flow 3.0.
Source Code
This endpoint is located in the gravityflow/includes/rest-api/v2/ folder with most of the route code in the class-controller-steps.php file.