업데이트하려고 시도하기 전에 항목을 업데이트하지 않고 client.entries().async().unPublish(entry)
을 사용하여 항목의 게시를 취소하고 작동하지만 아래 코드를 사용하여 업데이트하려고하면 항목이 업데이트됩니다. 메시지를 따르십시오 : java.lang.IllegalArgumentException: entry must have a space associated.
Contentful에서 항목을 업데이트하는 방법
내가 뭘 잘못하고 있니?
final CMAClient client =
new CMAClient
.Builder()
.setAccessToken(contentfulConnection.getCMA_TOKEN())
.build();
final CMASystem sys = new CMASystem();
sys.setId(entryID).setVersion(CurrentVersion);
CMAEntry entry;
entry.setField("name", "en-US", "TEST").setSystem(sys);
entry.setSpaceId(SPACE_ID);
entry.setID("entryID");
client.entries().async().update(entry, new CMACallback<CMAEntry>() {
@Override protected void onSuccess(CMAEntry entry) {
// Successfully created a new entry.
new AlertDialog.Builder(ctx).setTitle("Contentful")
.setMessage("Creation of an entry was successful." +"\n\nResult:
" +
entry).show();
} }
@Override protected void onFailure(RuntimeException exception) {
// An error occurred! Inform the user.
new AlertDialog.Builder(ctx)
.setTitle("Contentful Error")
.setMessage("Could not create an entry." +
"\n\nReason: " + exception.toString())
.show();
System.out.println(exception.toString());
super.onFailure(exception);
}
}
);