I'm trying to update a field of an entry in contentful, but this error is thrown each time:
java.lang.IllegalArgumentException: entry must have a space associated. at com.contentful.java.cma.AbsModule.getSpaceIdOrThrow(AbsModule.java:87) at com.contentful.java.cma.ModuleEntries.update(ModuleEntries.java:345) at com.contentful.java.cma.ModuleEntries$Async$14.method(ModuleEntries.java:700)
I am building the client and providing the spaceId:
@Bean
CMAClient cmaClient() {
return new CMAClient.Builder()
.setAccessToken(contentManagementToken)
.setSpaceId(spaceId)
.setEnvironmentId("master")
.build();
}
and this is where the error is being thrown:
CMAEntry entry = new
CMAEntry().setSystem(sys)
.setId(response.items().get(i).id())
.setField("questionText", "en-US", question.getQuestionText()));
cmaClient.entries().update(entry);
If I do set the space id for the entry like this:
CMAEntry entry = new CMAEntry().setSystem(sys)
.setId(response.items().get(i).id())
.setSpaceId(spaceId)
.setField("questionText", "en-US", question.getQuestionText());
cmaClient.entries().update(entry);
I get a different error message:
FAILED ErrorBody { details = Details { errors = [Error { details = The property "space" is not allowed here., name = unknown,....
I've turned the Internet upside down to find a solution to this and documentation for Java doesn't provide a solution.