Support Topics Documentation Slack YouTube Blog

Help! Trouble calling generated API in JavaScript

Mission: SERVERLESS 101
Task: Invoke the API Service using generated client SDK

Please, describe your problem here.

I am trying to call the generated JavaScript API downloaded from backendless. I am using Visual Studio Code with the Live Server plugin to self host the test web page. When I click on the link for Get Instructions, I am receiving the following error on the console (using Chrome):

POST https://api.backendless.com///services/CodelessShoppingCartService/getInstructions 404 (Not Found)
(anonymous) @ backendless.min.js:formatted:1407
v @ backendless.min.js:formatted:1370
b.send @ backendless.min.js:formatted:1641
value @ backendless.min.js:formatted:1596
value @ backendless.min.js:formatted:1622

Anybody have any idea what I might be doing wrong here, or what I should check?

Thanks,

Aaron

Hi Aaron,

It looks like application ID and API key are missing in the URL. This tells me the Backendless.initApp call didn’t happen. Please check if you have that in the code that runs. It should be the very first thing that happens in the client-side app.

Regards,
Mark

Hi Mark,

Thanks for the response. I didn’t have a call to the initApp method. I added a call to the initApp with the API key and App ID, and indeed, the POST call contains these in the URL. I get a different error now, 403 forbidden. The details are shown below.

So, two questions.

  1. I guess I’m just wondering why the API key and APP ID are passed in the url itself, rather than in a header or query string parameter? It seems a little unusual.

  2. I guess my trial period expired or something? Do I need to do something with my account to be able to continue with the missions?

Thanks again for the quick response.

backendless.min.js:15 POST https://api.backendless.com/1EAA52D9-2835-B702-FF08-09CF19BD2F00/2396FE75-35CA-44C2-B4C5-1210A3CAB23E/services/CodelessShoppingCartService/getInstructions 403 (Forbidden)
(anonymous) @ backendless.min.js:15
v @ backendless.min.js:15
b.send @ backendless.min.js:15
value @ backendless.min.js:15
value @ backendless.min.js:15
backendless.min.js:15 Uncaught (in promise) Error: The application has been blocked due to exceeding a limit.
at new t (backendless.min.js:15)
at m (backendless.min.js:15)
t @ backendless.min.js:15
m @ backendless.min.js:15
Promise.then (async)
getInstructions @ controller.js:11
(anonymous) @ VM17:1

OK, sorry. It looks like I didn’t quite understand how the pricing options worked. So, I guess I was on a trial plan, which expired, but I had not completed enough missions to unlock the Springboard plan? I think I was pretty close . . .

At this point I would need to purchase the springboard shortcut for development ($50), or sign up for one of the paid plans ($25/mo)? Is this correct?

Thanks,

Aaron

Hi Aaron,

Looks like the trial period for the application has expired and all calls will result in error:

At this point you can either purchase Springboard Shortcut or delete that app and create a new one. Your missions progress will not be lost.

Regards,
Mark

Thanks! Is working now.

Any plans on supporting .NET for generated SDK’s in the future?

Yes, generated .net code is coming soon