Forum Discussion

george_ingelby's avatar
2 years ago

Override current_revision.last_edit_author.id

Hi there,

When creating a post via the API you can do the following

 

<#assign apiCall = restBuilder()
.method('POST')
.path("/messages")
.body('{
"data":{
"author": { "type": "user", "id": "' + getAuthorId() +'" },
"type":"message",
"subject":"' + key +'",
"body":"'+value+'",
"context_id":"' + key +'",
"board":{
"id":"'+ boardid +'"
}
}
}')
.admin(true) />

This will essentially set the author id to any user you desire.

However if this message is updated, you can not set the following

        <#assign apiCall = restBuilder()
.method('PUT')
.path("/messages/" + id)
.body('{
"data":{
"author": { "type": "user", "id": "' + getAuthorId() +'" },
"current_revision": { "last_edit_author": { "type": "user", "id": "' + getAuthorId() +'" } },
"type":"message",
"subject":"' + key +'",
"body":"'+value+'",
"context_id":"' + key +'"
}
}')
.admin(true) />

 

Am I missing something or is there another way to do this?

No RepliesBe the first to reply