As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hi everyone,
I have one custom search webscript with me which I am able to call from POSTMAN, in which I need to send 5 different values in json format and I get the related document in response. Now I want to call this webscript from custom share surf page. I have created one surf page and added 5 textbox and 1 button in that page now how can I call webscript with json request parameter to get the same response I'm getting from POSTMAN.
Thanks,
Dhrumil
Hi,
Please follow below tutorial.
Webscript
To call a repository webscript you can do something similar to the below example:
//JSON Payload var searchPayload = { "offerName":"test", "offerPrice":"$100" } Alfresco.util.Ajax.request({ //e.g.: http://localhost:8080/alfresco/service/searchOffers url : Alfresco.constants.PROXY_URI + "/searchOffers", requestContentType:Alfresco.util.Ajax.JSON, responseContentType:Alfresco.util.Ajax.JSON, dataObj:searchPayload, method:Alfresco.util.Ajax.POST, timeout:180000, successCallback : { fn : function (response) { //TODO:: do something with response }, scope : this }, failureCallback : { fn : function (response) { //TODO:: do something in case of failure response }, scope : this } });
You can refer to this post as well, its quite old but may be helpful: https://blog.arvixe.com/webscript-call-in-client-side-javascript-of-alfresco/