Workflow

View as Markdown

Workflow

Workflow is a tool that allows you to streamline the process of content creation and publishing and lets you manage the content lifecycle of your project smoothly.

updatePublishRule

The "Add or Update Publish Rules" request allows you to add a publishing rule or update the details of the existing publishing rules of a workflow.

NameTypeDescription
ruleUid (required)String

The UID of the publishing rule that you want to update.

requestBody (required)

The request body.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.updatePublishRule("ruleUid", requestBody).execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

fetchPublishContentType

The "Get Publish Rules by Content Types" request allows you to retrieve details of a Publish Rule applied to a specific content type of your stack.

NameTypeDescription
contentTypeUid (required)String

The UID of the content type of which you want to retrieve the Publishing Rule.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.fetchPublishRuleContentType("contentTypeUid").execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

deletePublishRule

The "Delete Publish Rules" request allows you to delete an existing publish rule.

NameTypeDescription
ruleUid (required)String

The UID of the published rule that you want to delete.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.deletePublishRule("ruleUid").execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

createPublishRule

The "Create Publish Rules" request allows you to create publish rules for the workflow of a stack.

NameTypeDescription
requestBody (required)JSONObject

Specify the unique IDs of the branches for which the publishing rule will be applicable in the schema in the request body.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.createPublishRule(requestBody).execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

fetchTasks

The "Get all Tasks" request retrieves a list of all tasks assigned to you.

When executing the API request, in the 'Header' section, you need to provide the API Key of your stack and the authtoken that you receive after logging into your account.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.fetchTasks().execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

disable

Disable Workflow request allows you to disable a workflow.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.disable().execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

enable

The "Enable Workflow" request allows you to enable a workflow.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.enable().execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

update

The "Add or Update Workflow" request allows you to add a workflow stage or update the details of the existing stages of a workflow.

NameTypeDescription
requestBody (required)JSONObject

The body should be in JSONObject format.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.update(requestBody).execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

create

The "Create a Workflow" request allows you to create a Workflow.

NameTypeDescription
requestBody (required)JSONObject

The details of the workflow in JSONObject format.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.create(requestBody).execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

delete

The "Delete webhook" call deletes an existing webhook from a stack.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.delete().execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

fetch

The "Get a Single Workflow" request retrieves the comprehensive details of a specific Workflow of a stack.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.fetch().execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

find

The "Get a Single Workflow" request retrieves the comprehensive details of a specific Workflow of a stack.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

Call<ResponseBody> response = workflow.find().execute();

if (response.isSuccessful) {

	System.out.println("Response" + response);

}

addParam

Sets header for the request.

NameTypeDescription
key (required)String
Query parameter key for the request.
value (required)Object
Query parameter value for the request.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

workflow.addParam("key", value);

removeParam

Set header for the request.

NameTypeDescription
key (required)String

Removes query parameters using the key of the request.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

workflow.removeParam("key");

addHeader

Sets header for the request.

NameTypeDescription
key (required)String
Header key for the request.
value (required)Object
Header value for the request.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Workflow workflow = contentstack.stack().workflow();

workflow.addHeader("key", value);