This is the js function i used in worklight to update a document in Domino:
function updateDoc(docId,newValue) {
var identity = Base64.encode("myDominoUsername:myDominoPassword");
path = "/Databases/Temp/dominoApp.nsf/BestRestTest.xsp/updateService/unid/"+docId;
var input = {
method : 'post',
returnedContentType : 'json',
headers:{
Authorization: "Basic "+"b4lzdD234GG3M6SdW1XI=" //base64 encoding of your //credentials, see above. The function Base64.encode can be found by googling about it in //js. So you replace this string with identity variable.
"X-HTTP-Method-Override":"PATCH",
"Content-Type":"application/json"
},
body: {
contentType: 'application/json; charset=utf-8',
content: JSON.stringify({"theField":newValue})
},
path : path
};
return WL.Server.invokeHttp(input);
}
Now on the Domino side i have added an extension library REST control (alternatively you can do it with Domino Data Service). The properties i ve added are:
- pathInfo: whatever you want
- service: documentJsonService
- computeWithForm:true
- defaultItems:true
- formName:myformName
This is just client side javascript, so you can do it in a similar way from an XPage.