Stack
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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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);
}| Name | Type | Description |
|---|---|---|
| roleUid | String | 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.
| Name | Type | Description |
|---|---|---|
| webhookUid | String | 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| releaseUid | String | 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.
| Name | Type | Description |
|---|---|---|
| publishQueueUid | String | 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).
| Name | Type | Description |
|---|---|---|
| code | String | 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.
| Name | Type | Description |
|---|---|---|
| labelUid | String | 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.
| Name | Type | Description |
|---|---|---|
| globalFiledUid | String | 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.
| Name | Type | Description |
|---|---|---|
| customFieldUid | String | 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| contentTypeUid | String | 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.
| Name | Type | Description |
|---|---|---|
| branchUid | String | 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.
| Name | Type | Description |
|---|---|---|
| logItemUid | String | 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.
| Name | Type | Description |
|---|---|---|
| assetUid (required) | String | The asset Uid. |
| folder | String | 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_folders | Boolean | Set this parameter to ‘true’ to include the details of the created folders along with the details of the assets. Example:true. |
| environment | String | Enter the name of the environment to retrieve the assets published on them. You can enter multiple environments. Example: production |
| version | Integer | 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_details | Boolean | Enter 'true' to include the published details of the entry. |
| include_count | Boolean | Set this parameter to 'true' to include the total number of assets available in your stack in the response body. |
| relative_urls | Boolean | Set this to 'true' to display the relative URL of the asset. |
| asc_field_uid | String | Enter the unique ID of the field for sorting the assets in ascending order by that field. Example:created_at |
| desc_field_uid | String | Enter the unique ID of the field for sorting the assets in descending order by that field. Example:file_size |
| include_branch | Boolean | 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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")