Support Topics Documentation Slack YouTube Blog

Stuck in Serverless 101

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

Please, describe your problem here.

Hi
I have only one step left in Serverless 101 - the 2nd step. This one is a puzzle and I will need help. I use AppGyver as my nocode client, I like it a lot as I like Backendless a lot.
The example video for the 2nd step uses js as the example on how to do the additem of CodelessShoppingCartService. But I need a NoCode example. One of your staff made a very good tutorial of Backendless with AppGyver, which i followed and completed before I started these missions. He/she would probably know how to use AppGyver’s data configurator to call the methods of CodelessShoppingCartService. Could I please request assistance with this and an example of how to do this .
Kind Regards
BruceX

image

Hello @Bruce_X

You need to call the methods of the CodelessShoppingCard service. For example, using AppGyver you can add several buttons and add logic to call the necessary methods to them. You can find method cURL here: https://monosnap.com/direct/OCgfZU5sNJW3dbRqwyq9hTWItz0u1V
After you add each method from the service, call them in the desired sequence

Regards,
Inna

Inna
Thank you for such a quick reply. I followed your procedure but obviously I got it wrong.
The AppGyver screen looks like…

The GetInstructions button works well, because there are no parameters.

For the AddItem I put the entire contents of the cURL into the Open URL logic, but that obviously did not work. I believe Open URL wants a URL with parameters. What would be the URL be with the parameters for this example be for the AddItem? I have tried some things but nothing I have tried has worked.

@Bruce_X

The “addItem” request contains parameters that must be passed in the request body.
Use schema in the Data Configuration https://monosnap.com/direct/6NoHwOaHUfQlgFo9qBhbm9qk5D8H5J

Regards,
Inna

Hi Inna

Thanks for the hint, it got me a lot further.

My AppGyver screen looks like

The schema is for the purchase is…
image

Each button reports success when it is clicked, including the Purchase button.
However, when I check the tables in Backendless, Order is not there, also I am not getting the completed message. CAn you complete this for me and unlock the next mission.

Thanks
BruceX

@Bruce_X

If you invoke these methods in Backendless console in the business logic section, then the Order table is not created ?

Regards,
Inna

Hi Inna
That is correct. All the methods return a 200 (thats good isn’t it?) in the console and in AppGyver. In the console this is how the Invokes went…

getInstructions

addItem - note mycart was the name of the cart in the javascript example

getItems

purchase

So, you can see that all seems good here, if there is an error on my part I cannot spot it, please let me know or let me through please. I have 2 days in hand to get this complete, apologies for the pressure but my trial period is about to expire.

It seems these hiccups are only in the missions, backendless itself is brilliant and I want to stay with it.

Kind Regards
BruceX

@Bruce_X,

While all operations return 200 OK, it doesn’t mean that all operations actually did something useful. For example, take a look at adding an item:

You specify the cart name, but there is no item to add. The method succeeds since there is no error - you simply not adding anything to the cart. As a result, when you’re purchasing the items in the cart, there is nothing to purchase and then no Order object is saved in the database. And subsequently, the task is not completed.

If you change the payload of the addItem method to include the item information and repeat the sequence, it should work. For instance, the payload for addItem could look something like this:

{
  "cartName":"mycart",
  "item": {
    "name":"apples",
    "quantity":5
  }
}

Regards,
Mark

Hi Mark
Thanks for your quick reply

omg, I cant believe I missed that
.

Still no cigar

If I remember correctly, that task consists of 4 invocations but looks like you did it with only 3, hence no cigar :wink:

Hi Mark

By 4 invocations I presume you mean GetInstructions, AddItem, GetItems and Purchase. If you mean something else please let me know.

Look back through prior entries in this conversation and you will see that I have done all 4, successfully.
Hope to hear from you soon, I have just received my 2 day warning on the trial end.
Bruce X

Mission was completed.

Thank you very much

Hi, thank you so much for setting my last mission as complete.
btw, the Order table did not get created despite my steps completing successfully, is that a concern?

2nd question.
I am more interested in getting this tutorial to run correctly in AppGyver. I hope that you can answer this question.
In the backendless rest consol when I create an item with getItem, the response is…


So far so good.
If I go thru the same exercise in AppGyvers data configurator I get…

The error is because I believe that AppGyver is expecting the array to be named, but I am a beginner at AppGyver and Backendless, so I am wondering how the response of the GetItems can be referenced and used.
Other screen dumps that may help with your answer…
The Base…

The set up for the Get Record Collection (what should the Response Key Path be set to?

Kind Regards
Bruce X

Provide, please, appId.

Hi
Appid = 188534

Hello @Bruce_X

Actually, the orders data is stored in the Backendless Cache, that’s why there is no Order table in the Data Service

Thank you, I did not know, I noticed a few small differences between backendless now and when the video was made, including this one,

All Good - thanks

Oh, sorry for the misunderstanding, I meant when you create a new Item it’s saved in the Cache

but when you call the purchase method it saves the order in the Order table

Ok, I do understand this, so we get back to my original question, which is important for future use of APIs like this. The Purchase method returned success after proving with GetItem that the cartItem was created successfully in cache. So why did the Order table not get created as per the above logic with the Purchase method.
Please, this is only a small question so if to get to answer is going to take a lot of digging, the question is not important enough to justify the effort.

I thank you for answering the above anyway.

BruceX