zerocool87 zerocool87 - 10 months ago 44
reST (reStructuredText) Question - Random error 404 during REST API

for one web app I'm using as MBAAS .

I created a data model and linked all tables.

If I query the default REST APIs there is no problem at all, however if I try to call custom action or custom query the server randomly answer with error 404 not found....

For example I've this custom action named: getCommentsByEvent

'use strict';
function backandCallback(userInput, dbRow, parameters, userProfile) {
// write your code here
return $http ({
method: 'GET',
url: CONSTS.apiUrl + '/1/query/data/getCommentsByEvent',
params: {
parameters: {
event_id: {{event_id}}
headers: {"Authorization": userProfile.token}


From the web App I use this code to call it via REST

service.commentsByEvent = function(p, s, r) {
method: 'GET',
url: Backand.getApiUrl() + '/1/objects/action/comments/?name=getCommentsByEvent',
params: {
parameters: {
event_id: p.eventId
}).then(s, r);

The custom action is written correctly because if I try to call it directly from test page of it works without any problem, however if I try from my web app 80% of the time it does not work, 20% it works

This is the error:

Object {data: "Action not found, or is not on demand", status: 404, config: Object, statusText: "Not Found"}

Just to know:
- the action does not have security profile or role or others;
- before to call this action web app call the signin API to get the token
- the action does not need the auth token because is public

To call the signin API I made this service:

service.signin = function(email, password) {
//set the app name of Backand. In your app copy this to .config section with hard coded app name
//call Backand for sign in
return Backand.signin(email, password);
service.signout = function() {
return Backand.signout();

Any idea?


Answer Source


It was a very dummy issue related with the "App name" created on website....

On I created an app with all name in uppercase like "MYAPP" so when I configured the SDK on Angular I wrote


However display the same name on the website, but during the configuration it require a LOWERCASE ONLY name! Nobody, even in customer care, knew this requirements so it was very difficult to understand how to fix... Yesterday I did a try in this way and it worked...


To sum up, if you have an error 404 and the URL is correct, there is no authentication issue check if the APP NAME is ONLY LOWERCASE.