Hi,
I'm in the process of creating an app extension to Process Center -
Publisher in order to add a new API. I have created publisher-apis
directory structure in extensions/app/ directory path. This is my app.js
file where search.jag is the controller to serve the new API.
app.dependencies=['publisher-common'];
app.server = function(ctx) {
return {
endpoints: {
apis: [{
url:'search',
path:'search.jag',
secured:true
}]
}
}
};
app.apiHandlers = function(ctx) {
return {
onApiLoad: function() {
if ((ctx.isAnonContext) && (ctx.endpoint.secured)) {
//ctx.res.status='401';//sendRedirect(ctx.appContext+'/login');
print('{ error:"Authentication error" }'); //TODO: Fix this
to return a proper status code
return false;
}
return true;
}
};
};
And this is my JS function from where the new endpoint is called.
if($("#content").val()){
var search_url = caramel.tenantedUrl('/apis/search') ;
$.ajax({
url: search_url,
method: 'POST',
data: 'search-query:'+ $("#content").val(),
success:function(data){
if(data){
console.log("success");
}
},error:function(xhr, status, error){
console.log(error);
doPagination = false;
$('.loading-animation-big').remove();
}
});
}
But it gives me the error: "Unable to locate a suitable endpoint for
search". Any help would be highly appreciated.
Thanks,
Sathya
*Sathya Bandara*
Software Engineering Intern
Email: [email protected]
Mobile: +94 715 360 421
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev