05-13-2020 01:23 AM
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
05-13-2020 02:54 AM
05-13-2020 05:40 PM
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/
Explore our Alfresco products with the links below. Use labels to filter content by product module.