Releases

View as Markdown

Releases

The Releases class provides methods to create, manage, and deploy content releases that group entries and assets for coordinated publishing across environments.

NotePass the release_version parameter as 2.0 in the Headers section if you have the latest release enabled for your organization. Reach out to our support team for more information.

create

The create method creates a new release in the stack.

NameTypeDescription
requestBody (required)JSONObject

The requestBody to create a release.

Example:

import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Release release = contentstack.stack().releases();
Call<ResponseBody> response = release.create(requestBody).execute();
if (response.isSuccessful()) {
    System.out.println("Release created successfully.");
}

update

The update method modifies the name, description, or schedule of an existing release.

NameTypeDescription
requestBody (required)JSONObject

Request body to update a release

Example:

import contentstack;

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

Call<ResponseBody> response = contentstack.stack().releases().update().execute();

if (response.isSuccessful()) {

    System.out.println("Release updated successfully.");

}

fetch

The fetch method retrieves details of a specific release using its UID.

Example:

import contentstack;

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

Call<ResponseBody> response = contentstack.stack().releases("RELEASE_UID").fetch().execute();
if (response.isSuccessful()) {
    System.out.println("Fetched release.");
}

clone

The clone method creates a duplicate of an existing release with a new name or description.

NameTypeDescription
requestBody (required)JSONObject

Request body to clone a release

Example:

import contentstack;

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

Call<ResponseBody> response = contentstack.stack().releases("RELEASE_UID").clone(requestBody).execute();
if (response.isSuccessful()) {
    System.out.println("Release cloned successfully.");
}

delete

The delete method removes a specific release from the stack

Example:

import contentstack;

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

Call<ResponseBody> response = contentstack.stack().releases("RELEASE_UID").delete().execute();
if (response.isSuccessful()) {
    System.out.println("Release deleted successfully.");
}

deploy

The deploy method deploys all entries and assets from a release to specified environments and locales.

NameTypeDescription
requestBody (required)JSONObject

The requestBody to deploy a release.

Example:

import contentstack;

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

Call<ResponseBody> response = contentstack.stack().releases("RELEASE_UID").deploy(requestBody).execute();
if (response.isSuccessful()) {
    System.out.println("Release cloned successfully.");
}

addParam

The addParam method sets a query parameter for the release request.

NameTypeDescription
key (required)String

Key of the query parameter

value (required)Object

Value of the query parameter

Example:

import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Release release = contentstack.stack().release();
release.addParam("key", value);

addHeader

The addHeader method sets a header for the release request.

NameTypeDescription
key (required)String

Key of the header

value (required)Object

Value of the header

Example:

import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Release release = contentstack.stack().release();
release.addHeader("key", value);

removeParam

The removeParam method removes a previously set query parameter from the release request.

NameTypeDescription
key (required)String

Key of the query parameter to remove

Example:

import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Release release = contentstack.stack().release();
release.removeParam("key");