Branch

View as Markdown

Branch

Branches allow you to isolate and easily manage your “in-progress” work from your stable, live work in the production environment. It helps multiple development teams to work in parallel in a more collaborative, organized, and structured manner without impacting each other.

create

The "Create a branch" request creates a new branch in a particular stack of your organization.

NameTypeDescription
body (required)JSONObject

The request body.

import contentstack;

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

Branch branch = contentstack.stack().branch();

Call<responsebody> response = branch.create("body");

if (response.isSuccessful) { 

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

}

fetch

The "Get a single branch" request returns information about a specific branch.

import contentstack;

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

Branch branch = contentstack.stack().branch();

Call<ResponseBody> response = branch.fetch();

if (response.isSuccessful) { 

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

}

find

The "Get all branches" request returns comprehensive information about all the branches available in a particular stack in your account.

import contentstack;

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

Branch branch = contentstack.stack().branch();

Call<ResponseBody> response = branch.find();

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();

Branch branch = contentstack.stack().branch();

branch.addParam("key", value);

addHeader

Sets header key 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();

Branch branch = contentstack.stack().branch();

branch.addHeader("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();

Branch branch = contentstack.stack().branch();

branch.removeParam("key");

delete

The "Get assets and folders of a parent folder" retrieves details of both assets and asset subfolders within a specific parent asset folder.

import contentstack;

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

Branch branch = contentstack.stack().branch();

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

if (response.isSuccessful){

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

}