public class ModuleEntries extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
ModuleEntries.Async
Async module.
|
| Constructor and Description |
|---|
ModuleEntries(retrofit2.Retrofit retrofit,
Executor callbackExecutor,
String spaceId,
String environmentId,
boolean environmentIdConfigured)
Create entries module.
|
| Modifier and Type | Method and Description |
|---|---|
CMAEntry |
archive(CMAEntry entry)
Archive an Entry.
|
ModuleEntries.Async |
async() |
CMAEntry |
create(String contentTypeId,
CMAEntry entry)
Create a new Entry in the configured space and environment.
|
CMAEntry |
create(String spaceId,
String environmentId,
String contentTypeId,
CMAEntry entry)
Create a new Entry.
|
protected com.contentful.java.cma.ServiceEntries |
createService(retrofit2.Retrofit retrofit) |
Integer |
delete(CMAEntry entry)
Delete an Entry.
|
CMAArray<CMAEntry> |
fetchAll()
Fetch all Entries from the configured space and environment.
|
CMAArray<CMAEntry> |
fetchAll(Map<String,String> query)
Fetch all entries matching the query from the configured space and environment.
|
CMAArray<CMAEntry> |
fetchAll(String spaceId,
String environmentId)
Fetch all entries from the given space and environment.
|
CMAArray<CMAEntry> |
fetchAll(String spaceId,
String environmentId,
Map<String,String> query)
Fetch all entries from the given space and environment matching the query.
|
CMAArray<CMASnapshot> |
fetchAllSnapshots(CMAEntry entry)
Fetch all snapshots of an entry.
|
CMAArray<CMASnapshot> |
fetchAllSnapshotsWithQuery(CMAEntry entry,
Map<String,String> query)
Fetch all snapshots of an entry with additional query parameters.
|
CMAEntry |
fetchOne(String entryId)
Fetch an entry with the given
entryId from the configured space and environment. |
CMAEntry |
fetchOne(String spaceId,
String environmentId,
String entryId)
Fetch an entry with the given entryId from the given environment and space.
|
CMASnapshot |
fetchOneSnapshot(CMAEntry entry,
String snapshotId)
Fetch a specific snapshot of an entry.
|
CMAEntry |
patch(CMAEntry entry,
List<Map<String,Object>> operations)
Patch an Entry using JSON Patch operations.
|
CMAEntry |
patch(String spaceId,
String environmentId,
String entryId,
Integer version,
List<Map<String,Object>> operations)
Patch an Entry using JSON Patch operations.
|
CMAEntry |
publish(CMAEntry entry)
Publish an Entry.
|
CMAEntry |
publishLocale(CMAEntry entry,
String locale)
Publish an Entry for a specific locale.
|
CMAEntry |
unArchive(CMAEntry entry)
Un-Archive an Entry.
|
CMAEntry |
unPublish(CMAEntry entry)
Un-Publish an Entry.
|
CMAEntry |
unPublishLocale(CMAEntry entry,
String locale)
Un-Publish an Entry for a specific locale.
|
CMAEntry |
update(CMAEntry entry)
Update an Entry.
|
public ModuleEntries(retrofit2.Retrofit retrofit,
Executor callbackExecutor,
String spaceId,
String environmentId,
boolean environmentIdConfigured)
retrofit - the retrofit instance to be used to create the service.callbackExecutor - to tell on which thread it should run.spaceId - the space to be used when not given.environmentId - the environment to be used when not given.environmentIdConfigured - internal helper to see if environment was set.protected com.contentful.java.cma.ServiceEntries createService(retrofit2.Retrofit retrofit)
public CMAEntry archive(CMAEntry entry)
entry - EntryCMAEntry result instanceIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.public CMAEntry create(String contentTypeId, CMAEntry entry)
In case the given entry has an ID associated with it, that ID will be used,
otherwise the server will auto-generate an ID that will be contained in the response upon
success.
contentTypeId - Content Type IDentry - EntryCMAEntry result instanceIllegalArgumentException - if configured space id is null.IllegalArgumentException - if configured environment id is null.IllegalArgumentException - if contentTypeId is null.IllegalArgumentException - if entry is null.CMAClient.Builder.setSpaceId(String),
CMAClient.Builder.setEnvironmentId(String)public CMAEntry create(String spaceId, String environmentId, String contentTypeId, CMAEntry entry)
In case the given entry has an ID associated with it, that ID will be used,
otherwise the server will auto-generate an ID that will be contained in the response upon
success.
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String) and
CMAClient.Builder.setEnvironmentId(String).
spaceId - Space IDenvironmentId - Environment IDcontentTypeId - Content Type IDentry - EntryCMAEntry result instanceIllegalArgumentException - if spaceId is null.IllegalArgumentException - if environmentId is null.IllegalArgumentException - if contentTypeId is null.IllegalArgumentException - if entry is null.public Integer delete(CMAEntry entry)
entry - Entry IDIllegalArgumentException - if spaceId is null.IllegalArgumentException - if environmentId is null.IllegalArgumentException - if entryId is null.IllegalArgumentException - if entry is null.public CMAArray<CMAEntry> fetchAll()
This fetch uses the default parameter defined in DefaultQueryParameter.FETCH.
CMAArray result instanceIllegalArgumentException - if configured space id is null.IllegalArgumentException - if configured environment id is null.CMAClient.Builder.setSpaceId(String),
CMAClient.Builder.setEnvironmentId(String)public CMAArray<CMAEntry> fetchAll(Map<String,String> query)
This fetch uses the default parameter defined in DefaultQueryParameter.FETCH
query - the criteria to filter on.CMAArray result instanceIllegalArgumentException - if configured space id is null.IllegalArgumentException - if configured environment id is null.CMAClient.Builder.setSpaceId(String),
CMAClient.Builder.setEnvironmentId(String)public CMAArray<CMAEntry> fetchAll(String spaceId, String environmentId)
This fetch uses the default parameter defined in DefaultQueryParameter.FETCH
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String) and
CMAClient.Builder.setEnvironmentId(String).
spaceId - Space IDenvironmentId - Environment IDCMAArray result instanceIllegalArgumentException - if spaceId is null.IllegalArgumentException - if environmentId is null.public CMAArray<CMAEntry> fetchAll(String spaceId, String environmentId, Map<String,String> query)
spaceId - Space IDenvironmentId - Environment IDquery - QueryCMAArray of entries matching the query.IllegalArgumentException - if spaceId is null.IllegalArgumentException - if environmentId is null.public CMAEntry fetchOne(String entryId)
entryId from the configured space and environment.entryId - Entry IDCMAEntry result instanceIllegalArgumentException - if configured space id is null.IllegalArgumentException - if configured environment id is null.IllegalArgumentException - if entry id is null.CMAClient.Builder.setSpaceId(String),
CMAClient.Builder.setEnvironmentId(String)public CMAEntry fetchOne(String spaceId, String environmentId, String entryId)
spaceId - Space IDenvironmentId - Environment IDentryId - Entry IDCMAEntry result instanceIllegalArgumentException - if space id is null.IllegalArgumentException - if environment id is null.IllegalArgumentException - if entry id is null.public CMAEntry publish(CMAEntry entry)
entry - EntryCMAEntry result instanceIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.public CMAEntry unArchive(CMAEntry entry)
entry - EntryCMAEntry result instanceIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.public CMAEntry unPublish(CMAEntry entry)
entry - EntryCMAEntry result instanceIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.public CMAEntry update(CMAEntry entry)
entry - EntryCMAEntry result instanceIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.IllegalArgumentException - if entry's version is null.public CMAEntry patch(CMAEntry entry, List<Map<String,Object>> operations)
This method allows partial updates to an entry using JSON Patch format (RFC 6902). The operations parameter should contain a list of patch operations, each with:
Important Note: JSON Patch cannot perform operations on non-existing fields. If the field is defined on the Content Type but has not been set on the Entry yet, the API will return a validation error when you try to perform an operation on this field. The accepted workaround is to pass the entire sub-object to the top-most existing field, including locale and initial value.
Example:
// This may result in a validation error if 'description' field is undefined:
List<Map<String, Object>> operations = Arrays.asList(
Map.of("op", "add", "path", "/fields/description/en-US", "value", "initial value")
);
// If 'description' field is not defined on Entry, but defined in the Content Type,
// make sure to provide the locale in the payload:
List<Map<String, Object>> operations = Arrays.asList(
Map.of("op", "add", "path", "/fields/description", "value",
Map.of("en-US", "initial value"))
);
entry - Entry containing the entry ID, space ID, environment ID, and versionoperations - List of JSON Patch operations to applyCMAEntry result instance with updated fieldsIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.IllegalArgumentException - if entry's version is null.IllegalArgumentException - if operations is null.public CMAEntry patch(String spaceId, String environmentId, String entryId, Integer version, List<Map<String,Object>> operations)
This method allows partial updates to an entry using JSON Patch format (RFC 6902).
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String) and
CMAClient.Builder.setEnvironmentId(String).
Important Note: JSON Patch cannot perform operations on non-existing fields. If the field is defined on the Content Type but has not been set on the Entry yet, the API will return a validation error when you try to perform an operation on this field. The accepted workaround is to pass the entire sub-object to the top-most existing field, including locale and initial value.
Example:
// This may result in a validation error if 'description' field is undefined:
List<Map<String, Object>> operations = Arrays.asList(
Map.of("op", "add", "path", "/fields/description/en-US", "value", "initial value")
);
// If 'description' field is not defined on Entry, but defined in the Content Type,
// make sure to provide the locale in the payload:
List<Map<String, Object>> operations = Arrays.asList(
Map.of("op", "add", "path", "/fields/description",
"value", Map.of("en-US", "initial value"))
);
spaceId - Space IDenvironmentId - Environment IDentryId - Entry IDversion - Entry version (from entry.getSystem().getVersion()) -
must match current entry versionoperations - List of JSON Patch operations to applyCMAEntry result instance with updated fieldsIllegalArgumentException - if spaceId is null.IllegalArgumentException - if environmentId is null.IllegalArgumentException - if entryId is null.IllegalArgumentException - if version is null.IllegalArgumentException - if operations is null.public CMAArray<CMASnapshot> fetchAllSnapshots(CMAEntry entry)
entry - the entry whose snapshots to be returned.IllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.public CMAArray<CMASnapshot> fetchAllSnapshotsWithQuery(CMAEntry entry, Map<String,String> query)
entry - the entry whose snapshots are to be returned.query - additional query parameters to refine the results.IllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.public CMASnapshot fetchOneSnapshot(CMAEntry entry, String snapshotId)
entry - the entry whose snapshot to be returned.snapshotId - the snapshot to be returned.IllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.IllegalArgumentException - if snapshotId is null.public CMAEntry publishLocale(CMAEntry entry, String locale)
entry - Entrylocale - Locale to publishCMAEntry result instanceIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.IllegalArgumentException - if locale is null.public CMAEntry unPublishLocale(CMAEntry entry, String locale)
entry - Entrylocale - Locale to unpublishCMAEntry result instanceIllegalArgumentException - if entry is null.IllegalArgumentException - if entry's id is null.IllegalArgumentException - if entry's space id is null.IllegalArgumentException - if locale is null.public ModuleEntries.Async async()
Copyright © 2026 Contentful, GmbH.. All rights reserved.