---
title: "Entry"
description: "Entry"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/java/reference/entry"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-21"
---

# Entry

## Entry

An entry is the actual piece of content created using one of the defined content types.

You can now pass the branch header in the API request to fetch or manage modules located within specific branches of the stack. Additionally, you can also set the include\_branch query parameter to true to include the \_branch top-level key in the response. This key specifies the unique ID of the branch where the concerned Contentstack module resides.

## versionName

Version naming allows you to assign a name to a version of an entry for easy identification.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.versionName(version, requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

Enter the version number of the entry to which you want to assign a name.

The request body in JSONObject format.

## unpublish

The "Unpublish an entry" call will unpublish an entry at once and allow you to do so automatically at a later date/time.

In the 'Body' section, you can specify the locales and environments from which you want to unpublish the entry. These details should be specified in the entry parameter. However, if you do not specify a locale, it will be unpublished from the master locale automatically.

You also need to mention the master locale and the version number of the entry that you want to publish.

In the case of Scheduled Unpublished, add the scheduled\_at key and provide the date/time in the ISO format as its value.

Example: "scheduled\_at":"2016-10-07T12:34:36.000Z"

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.unpublish(requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

The request body in JSONObject format.

## unlocalized

The "Unlocalize an entry request" is used to unlocalize an existing entry.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.unLocalize("localeCode").execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

Enter the code of the language to localize the entry of that particular language.

## publishWithReference

The "Publishing an Entry With References" request allows you to publish an entry with all its references simultaneously.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.publishWithReference(requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

The request body in JSONObject format.

## publish

The "Publish an entry" request lets you publish an entry either immediately or schedule it for a later date/time.

In the 'Body' section, you can specify the locales and environments to which you want to publish the entry. When you pass locales in the "Body", the following actions take place:

If you have not localized your entry in any of your stack locales, the Master Locale entry gets localized in those locales and is published

If you have localized any or all of your entries in these locales, the existing localized content of those locales will NOT be published. However, if you need to publish them all, you need to perform a Bulk Publish operation.

The locale and environment details should be specified in the entry parameter. However, if you do not specify any source locale(s), it will be published in the master locale automatically.

Along with the above details, you also need to mention the master locale and the version number of the entry that you want to publish.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.publish(requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

In the "Body" parameter, you need to provide the content of your entry based on the content type.

## localize

The "Localize an entry" request allows you to localize an entry, i.e., the entry will cease to fetch data from its fallback language and possess independent content specific to the selected locale.

**Note**: This request will only create the localized version of your entry and not publish it. To publish your localized entry, you need to use the Publish an entry request and pass the respective locale code in the locale={locale\_code} parameter.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.localize(requestBody, "localeCode").execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

In the "Body" parameter, you need to provide the content of your entry based on the content type.

Enter the code of the language to localize the entry of that particular language.

## importExisting

The "Import an existing entry" call will import a new version of an existing entry. You can create multiple versions of an entry.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.importExisting().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## getReference

The "Get references of an entry" call returns all the entries of content types that are referenced by a particular entry.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.getReference().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## getLanguage

The "Get languages of an entry" call returns the details of all the languages that an entry exists in.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.getLanguage().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## detailOfAllVersion

The "Get Details of All Versions of an Entry" request allows you to retrieve the details of all the versions of an entry.

The version details returned include the actual version number of the entry; the version name along with details such as the assigned version name, the UID of the user who assigned the name, and the time when the version was assigned a name; and the locale of the entry.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.detailOfAllVersion().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## versionNumber

Atomic operations are particularly useful when we do not want content collaborators to overwrite data. Though it works efficiently for singular fields, these operations come in handy, especially in the case of fields that are marked as "Multiple".

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.versionNumber(versionNumber, requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

Enter the version number of the entry that you want to delete.

Request body for the delete operation.

## removeParam

Set header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
entry.removeParam("key");
```

Removes query parameters using the key of the request.

## find

The "Find" call fetches the list of all the entries of a particular content type. It also returns the content of each entry in JSON format. You can also specify the environment and locale where you wish to get the entries.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.find().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## fetch

The "Get a single entry" request fetches a particular entry of a content type.

The content of the entry is returned in JSON format. You can also specify the environment and locale from which you wish to retrieve the entries.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.fetch().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## delete

The "Delete an entry" request allows you to delete a specific entry from a content type. This API request also allows you to delete single and/or multiple localized entries.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.delete(requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

You can delete specific localized entries by passing the locale codes in the Request body using the locales key.

## update

The "Update an entry" call lets you update the content of an existing entry.

Passing the locale parameter will cause the entry to be localized in the specified locale.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.update(requestBody).execute();
if (response.isSuccessful()){
   System.out.println(response.body().string());
} else {
   System.out.println(response.errorBody().string());
}
```

The request body for the entry update.

## export

The "Export an entry" call is used to export an entry. The exported entry data is saved in a downloadable JSON file.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.export().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## imports

The "Import an entry" call is used to import an entry. To import an entry, you need to upload a JSON file that has entry data in the format that fits the schema of the content type it is being imported to.

The Import an existing entry call will import a new version of an existing entry. You can create multiple versions of an entry.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.imports().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## create

The "Create an entry" call creates a new entry for the selected content type.

When executing the API call, in the 'Body' section, you need to provide the content of your entry based on the content type created.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
Call<ResponseBody> response = entry.create(requestBody).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

The requestBody to create/add a single Item.

## addParam

Sets header for the request.

**Note: Since HashMap does not allow duplicate keys like include\[\], use the includeReference method to retrieve the entry with reference fields.**

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
entry.addParam("key", value);
```

Query parameter key for the request.

Query parameter value for the request.

## addHeader

Sets header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().entry();
entry.addHeader("Key", value);
```

Header key for the request.

Header value for the request.

## includeReference

The includeReference method retrieves the content of the referenced entry.

```
includeReference with reference_field_uid as String:
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack("apiKey").contentType("contentType")
.entry("entry_uid");
Response<ResponseBody> response = entry
.includeReference("reference_uid_1")
.execute();
if (response.isSuccessful()) {
    System.out.println("Response" + response.body().string());
} else {
    System.out.println("Error Body" + response.errorBody().string());
}
includeReference with reference_field_uids as an array:
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack("apiKey").contentType("contentType")
.entry("entry_uid")
String[] array = {"reference_uid_1","reference_uid_2"};
Response<ResponseBody> response = entry.includeReference(array).execute();
if (response.isSuccessful()) {
    System.out.println("Response" + response.body().string());
} else {
    System.out.println("Error Body" + response.errorBody().string());
}
```

Enter the reference\_field value

## setWorkflowStage

The setWorkflowStage method allows you to set or update the workflow stage of an entry.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
String workflowStagePayload = "{\n" + 
" \"workflow\": {\n" + 
" \"workflow_stage\": {\n" + 
" \"comment\": \"WorkflowComment\",\n" + 
" \"due_date\": \"Thu Dec 01 2018\",\n" + 
" \"notify\": false,\n" + 
" \"uid\": \"workflow_stage_uid\",\n" + 
" \"assigned_to\": [\n" + 
" {\n"+ 
" \"uid\": \"user_uid\",\n" + 
" \"name\": \"Username\",\n" + 
" \"email\": \"user_email_id\"\n" + 
" }\n" + 
" ],\n" + 
" \"assigned_by_roles\": [\n" + 
" {\n" + 
" \"uid\": \"role_uid\",\n" + 
" \"name\": \"Rolename\"\n" + 
" }\n" + 
" ]\n" + 
" }\n" +
" }\n" + "}";
JSONParser parser = new JSONParser();
JSONObject body = (JSONObject) parser.parse(workflowStagePayload);
Entry entry = contentstack.stack(API_KEY,MANAGEMENT_TOKEN).contentType(contenttype).entry(entry_uid);
Response<ResponseBody> response = entry.setWorkflowStage(body).execute();
if (response.isSuccessful()) {
System.out.println("Response" + response.body().string());
} else {
System.out.println("Error Body" + response.errorBody().string());
}
```

Details for the workflow stage

## publishRequest

The publishRequest method allows you to either send a publish request or accept/reject a received publish request.

**Request Structure**

**Headers:** Include the API Key (stack identifier) and Auth Token (authentication).

**Body Parameters:**

*   uid – Publish rule identifier
*   action – "publish", "unpublish", or "both"
*   status – 0 (Approval Requested), 1 (Approval Accepted), -1 (Approval Rejected)
*   notification\_settings – Controls notification triggers
*   comment – Optional note for the approver

```
import contentstack
Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
String publishRequestPayload = "{\n" +
" \"workflow\": {\n" +
" \"publishing_rule\": {\n" +
" \"uid\": \"rule_uid\",\n" +
" \"action\": \"publish\",\n" +
" \"status\": 1,\n" +
" \"notify\": true,\n" +
" \"comment\": \"Approve this entry.\"\n" +
" }\n" +
" }\n" +
"}";
JSONParser parser = new JSONParser();
JSONObject body = (JSONObject) parser.parse(publishRequestPayload);
Entry entry = contentstack.stack(API_KEY,MANAGEMENT_TOKEN).contentType(contenttype).entry(entry_uid);
Response<ResponseBody> response = entry.publishRequest(body).execute();
if (response.isSuccessful()) {
System.out.println("Response" + response.body().string());
} else {
System.out.println("Error Body" + response.errorBody().string());
}
```

Details for the publishing rule

## fetchAsPojo

The fetchAsPojo method fetches a single entry by UID and deserializes it into a POJO.

```
import contentstack; 

Contentstack contentstack = new Contentstack.Builder().build();
Entry entry = contentstack.stack().contentType(content_type_uid).entry(entry_uid);
Response<EntryResponse> response = entry.fetchAsPojo().execute();
if (response.isSuccessful() && response.body() != null) {
    EntryResponse entryResponse = response.body();
    EntryPojo entrypojo = entryResponse.getEntryPojo();
    System.out.println(" Entry Title: " + entrypojo.title);
} else {
    System.out.println("Error: " + response.errorBody().string());
}
```

## findAsPojo

The findAsPojo method fetches multiple entries for a content type and deserializes them into POJOs.

```
import contentstack; 

Contentstack contentstack = new Contentstack.Builder().build();
Response<EntryListResponse> response = contentstack.stack().contentType(content_type_uid).entry().findAsPojo().execute();
if (response.isSuccessful() && response.body() != null) {
    EntryListResponse entryListResponse = response.body();
    List<EntryPojo> entries = entryListResponse.getEntries();
    for (EntryPojo entry : entries) {
        System.out.println(" Entry Title: " + entry.title);
    }
} else {
    System.out.println("Error: " + response.errorBody().string());
}
```

## Entry | Java Management SDK | Contentstack

Entry represents an actual piece of content created from a defined content type in the Java Management SDK.