Stack

View as Markdown

Stack

A stack is a space that stores the content of a project (a web or mobile property). Within a stack, you can create content structures, content entries, users, etc. related to the project.

workflow

A 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.

NameTypeDescription
workflowUid String

The UID of your workflow that you want to retrieve.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.workflow("workflowUid").execute();

if (response.isSuccessful) {

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

}

roles

A role is a collection of permissions that is applied to all the users who are assigned this role.

NameTypeDescription
body (required)JSONObject

The Update User Role API Request updates the roles of an existing user account. This API Request will override the existing roles assigned to a user. For example, we have an existing user with the Developer role, and if you execute this API request with the "Content Manager" role, the user role will lose Developer rights, and the user role be updated to just Content Manager.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.roles(body).execute();

if (response.isSuccessful) {

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

}

NameTypeDescription
roleUidString

The unique ID of the role of which you want to retrieve the details.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.roles("roleUid").execute();

if (response.isSuccessful) {

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

}

webhook

A webhook is a mechanism that sends real-time information to any third-party app or service to keep your application in sync with your Contentstack account. Webhooks allow you to specify a URL to which you would like Contentstack to post data when an event happens.

NameTypeDescription
webhookUidString

Enter the unique webhook ID from which you want to retrieve the details. Execute the Get all webhooks call to retrieve the UID of a webhook.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.webhook("webhookUid").execute();

if (response.isSuccessful) {

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

}

updateSetting

The "Add stack settings" request lets you add additional settings for your existing stack.

NameTypeDescription
requestBody (required)JSONObject

The request body in JSONObject format.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.updateSetting(requestBody).execute();

if (response.isSuccessful) {

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

}

update

The Update stack call lets you update the name and description of an existing stack.

NameTypeDescription
requestBody (required)JSONObject

The request body in JSONObject format.

import contentstack;

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

Stack stack = contentstack.stack();

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

if (response.isSuccessful) {

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

}

unshare

The "Unshare stack" removes the user account from the list of collaborators. Once this call is executed, the user will not be able to view the stack in their account.

NameTypeDescription
body (required)JSONObject

The request body in JSONObject format.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.unshare(body).execute();

if (response.isSuccessful) {

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

}

transferOwnership

The Transfer stack ownership to other users calls sends the specified user an email invitation for accepting the ownership of a particular stack.

Once the specified user accepts the invitation by clicking on the link provided in the email, the ownership of the stack gets transferred to the new user. Subsequently, the previous owner will no longer have permission on the stack.

NameTypeDescription
body (required)JSONObject

The request body in JSONObject format.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.transferOwnership(body).execute();

if (response.isSuccessful) {

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

}

tokens

Contentstack provides different types of tokens to authorize API requests. You can use Delivery Tokens to authenticate Content Delivery API (CDA) requests and retrieve the published content of an environment. To authenticate Content Management API (CMA) requests over your stack content, you can use Management Tokens.

Delivery tokens provide read-only access to the associated environments, while management tokens provide read-write access to the content of your stack. Use these tokens along with the stack API key to make authorized API requests

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.tokens().execute();

if (response.isSuccessful) {

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

}

share

The Share a stack call shares a stack with the specified user to collaborate on the stack.

NameTypeDescription
requestBody (required)String

The request body.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.share("requestBody").execute();

if (response.isSuccessful) {

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

}

setting

The "Get stack settings" call retrieves the configuration settings of an existing stack.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.setting().execute();

if (response.isSuccessful) {

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

}

resetSetting

The "Reset stack settings" call resets your stack to default settings and, additionally, lets you add parameters to or modify the settings of an existing stack.

NameTypeDescription
requestBody (required)String

The request body.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.resetSetting("requestBody").execute();

if (response.isSuccessful) {

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

}

releases

You can pin a set of entries and assets (along with the deploy action, i.e., publish/unpublish) to a release, and then deploy this release to an environment. This will publish/unpublish all the items of the release to the specified environment.

NameTypeDescription
releaseUidString

The unique ID of the release of which you want to retrieve the details.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.releases("releaseUid").execute();

if (response.isSuccessful) {

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

}

publishQueue

The Publishing Queue displays the historical and current details of activities such as publishing, unpublishing, or deleting that can be performed on entries and/or assets. It also shows details of Release deployments. These details include time, entry, content type, version, language, user, environment, and status.

NameTypeDescription
publishQueueUidString

The UID of a specific publish queue activity of which you want to retrieve the details. Execute the Get publish queue API request to retrieve the UID of a particular publish queue activity.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.publishQueue("publishQueueUid").execute();

if (response.isSuccessful) {

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

}

locale

Contentstack has a sophisticated, multilingual capability. It allows you to create and publish entries in any language. This feature allows you to set up multilingual websites and cater to a wide variety of audiences by serving content in their local language(s).

NameTypeDescription
codeString

The locale code.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.locale("code").execute();

if (response.isSuccessful) {

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

}

label

Labels allow you to group a collection of content within a stack. Using labels you can group content types that need to work together.

NameTypeDescription
labelUidString

The label.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.label("labelUid").execute();

if (response.isSuccessful) {

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

}

globalField

A Global field is a reusable field (or group of fields) that you can define once and reuse in any content type within your stack. This eliminates the need (and thereby time and effort) to create the same set of fields repeatedly in multiple content types.

NameTypeDescription
globalFiledUidString

The globalField UID.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.globalField("globalFiledUid").execute();

if (response.isSuccessful) {

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

}

extensions

Extensions let you create custom fields and widgets to customize Contentment's default UI and behavior. Read more about Extensions.

NameTypeDescription
customFieldUidString

The customField Uid.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.extensions("customFieldUid").execute();

if (response.isSuccessful) {

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

}

environment

A publishing environment corresponds to one or more deployment servers or a content delivery destination where the entries need to be published.

NameTypeDescription
environmentUid (required)String

The environment UID

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.environment("environmentUid").execute();

if (response.isSuccessful) {

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

}

create

The "Create stack call" creates a new stack in your Contentstack account.

NameTypeDescription
organizationUid (required)String

The organization uid.

requestBody (required)JSONObject

The request body should be in JSONObject format.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.create("organizationUid", requestBody).execute();

if (response.isSuccessful) {

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

}

contentType

The ContentType defines the structure or schema of a page or a section of your web or mobile property. To create content for your application, you are required to first create a content type, and then create entries using the content type.

NameTypeDescription
contentTypeUidString

Enter the unique ID of the content type from which you want to retrieve the details. The UID is generated based on the title of the content type. The unique ID of a content type is unique across a stack

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.contentType("contentTypeUid").execute();

if (response.isSuccessful) {

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

}

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.

NameTypeDescription
branchUidString

The unique ID of the branch of which you want to retrieve the details.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.branch("branchUid").execute();

if (response.isSuccessful) {

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

}

auditLog

An audit log displays a record of all the activities performed in a stack and helps you track all published items, updates, deletes, and the current status of the existing content.

NameTypeDescription
logItemUidString

The log Item Uid.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.auditLog("logItemUid").execute();

if (response.isSuccessful) {

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

}

asset

Assets refer to all the media files (images, videos, PDFs, audio files, and so on) uploaded in your Contentstack repository for future use.

NameTypeDescription
assetUid (required)String

The asset Uid.

folderString

Enter either the UID of a specific folder to get the assets of that folder or enter ‘cs_root’ to get all assets and their folder details from the root folder.

Example:bltd899999999.

include_foldersBoolean

Set this parameter to ‘true’ to include the details of the created folders along with the details of the assets.

Example:true.

environmentString

Enter the name of the environment to retrieve the assets published on them. You can enter multiple environments.

Example: production

versionInteger

Specify the version number of the asset that you want to retrieve. If the version is not specified, the details of the latest version will be retrieved.

Example:1

include_publish_detailsBoolean

Enter 'true' to include the published details of the entry.
Example:true

include_countBoolean

Set this parameter to 'true' to include the total number of assets available in your stack in the response body.

relative_urlsBoolean

Set this to 'true' to display the relative URL of the asset.

asc_field_uidString

Enter the unique ID of the field for sorting the assets in ascending order by that field.

Example:created_at

desc_field_uidString

Enter the unique ID of the field for sorting the assets in descending order by that field.

Example:file_size

include_branchBoolean

Set this to 'true' to include the _branch top-level key in the response. This key states the unique ID of the branch where the concerned Contentstack module resides.

Example:false

import contentstack; 


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

Asset asset = contentstack.stack().asset("assetUid");

allUsers

The "Get all users" of a stack call fetches the list of all users of a particular stack.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.allUsers().execute();

if (response.isSuccessful) {

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

}

alias

An alias acts as a pointer to a particular branch. You can specify the alias ID in your frontend code to pull content from the target branch associated with an alias.

NameTypeDescription
aliasUid String

The unique ID of the alias of which you want to retrieve the details. The UID of an alias is unique across a stack. Execute the Get all aliases call to retrieve the UID of an alias

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.alias("aliasUid").execute();

if (response.isSuccessful) {

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

}

acceptOwnership

The "Accept stack owned by another user" call allows a user to accept the ownership of a particular stack via an email invitation.

Once the user accepts the invitation by clicking the link, the ownership is transferred to the new user account. Subsequently, the user who transferred the stack will no longer have any permission on the stack.

NameTypeDescription
ownershipToken (required)String

The ownership token received via email by another user.

import contentstack;

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

Stack stack = contentstack.stack();

Call<ResponseBody> response = stack.acceptOwnership("ownershipToken").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();

Stack stack = contentstack.stack();

stack.addParam("key", value)

find

Find call fetches stack information.

All Stack: auth token is required to fetch all the stacks.

Single Stack: api_key and authtoken is required, and organization_uid is optional.

import contentstack;

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

Stack stack = contentstack.stack();

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

if (response.isSuccessful) {

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

}

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

Stack stack = contentstack.stack();

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

Stack stack = contentstack.stack();

stack.removeParam("key")