Pages are no longer Available (Open Page, Replace Page)

In that case, I’ll drop the two tutorials we drew from to get our backend set up with them. The first is the official tutorial from Backendless. However, I would currently only use it for getting ideas and tips from. For some reason, following the Register tutorial with them did not work – to be fair, though, I didn’t know about the “Dismiss Initial View” logic at that time, so maybe that was why.

The second tutorial set seems to be the OG source, if you will. We did actually learn to plug Dismiss into this one, so it’s our current setup and does work.
https://symmetricdynamite.gitbook.io/backendless-appgyver/

Both sources have other tutorials on making different kinds of calls through APIs, so definitely take a look-see when you have a chance.

Fun fact: Logging your user out is actually the easiest thing you’ll do once you have login/registration set up. It’s, basically, a button anywhere on your auth-only pages with this flow setup:

You can get both logic components shown on the Marketplace just like the Dismiss one. :slight_smile: I’m off to bed now. Take care, Troy.

Wow thanks for sharing @Dominik_Greene. Unfortunately, the screenshot can’t load. Which components are those?

Have a good rest, you take care too!

Good morning. Let’s see if it works when I reupload it:

If not, the flow is: “Component tap” → “Delete item from storage” → “Return to initial view”

Noted on that. thanks Dominik!

My turn to be sleeping soon hahahaha. Singapore time. Whereabouts you from?

You’re welcome. :slight_smile:

And enjoying life down here in Georgia, USA.

1 Like

@Dominik_Greene by any chance you know about updating records?

I could successfully Create Record of email, password, username, birthdate (On RUN TEST @ Data config, web)

But moving on to Update Record within the web (RUN TEST @ Data Config), there’s a prob.

Resource URLs are the same: https://apibackendless.com/APIcodes/users/register
For relative path and response key path at Create Record tab, I left them empty.
For the relative path and response key path at Update Record tab, I put them as /{objectId} and objectId respectively.

HTTP headers are the same with Content-Type and application/json.

I’m guessing the prob could lie with the resource URL or relative path but can’t seem to solve it.

:sob:

That’s what we’re studying right now and, chances are, you’ll figure it out before we do. If you do, don’t be shy about sharing your method. I’m assuming with “Update Record”, you’re trying to allow the user to edit their profile and the like. I’m actually quite curious if a new API is necessary or if you can just plug the Update PUT function into the existing API for your currentUser auth.

Right, will definitely update you when I come across it. :smiley:
I’m leaning towards having a singular API. I think a team member at backendless told me both ways work. But he will lean towards having a single API.

It makes sense. It cuts down on the unnecessary complexity and keeping track of half a dozen APIs for, more or less, the same user functions. Whoever gets there first, let’s share. :slight_smile:

yeap will do. Forums help expedite the learning.

Hey All

Just read this topic by accident…I have recently got my user details from the ‘Users’ table in Backendless pulling into my ‘profile page’. And am able to update them and send back.

  1. To pull the details in, on Page Focus I am using a GET RECORD that looks like this;
    The id is simply the owner ID. After the GET, I immediately set each value to a page variable. And it is these variables that I bind to the component, which at the moment are Input Fields because I am testing the ability to change them
  2. Editing them I used UPDATE RECORD PUT from the same API set up exactly as above…but what took me an age to figure out is the schema…someone at Backendless forum helped me…you need to define both request and response (which you can use the automatic import tool for…). And another crucial bit of info…all the Backendless docs say you need the user-token to get this working…but I found my problem was having it in there as an HTTP header…when I sorted the schema and took it out, it works…
    It took me a week of fiddling…the best advice I got was to ensure the API PUT is working just be keying in values in TEST and then when you know its working, then do the binding.

    And one more thing, I was having trouble getting the data types in Backendless and Appgyver to match…the fields in ‘Users’ default are STRING by default, I set my page variables as type=text, and then my input field componet would accept them.
    Hope my random advice helps…it was a struggle getting there but I did eventually!
1 Like

Thanks for this, mate. It actually makes a good bit of sense. I was a little confused myself if /{id} seamlessly translated into ownerId on Backendless. From what I gather here, it does, indeed. I’ll see if I can break this in on our app this weekend or so.

And yes, I can confirm that “text” variables in Appgyver normally correspond to strings in Backendless. Also, URLs in Backendless of an ‘image’ nature (usually ending in .jpg, .png, etc.) should always be bound to ‘Image URL’ in Appgyver.-- for example, avatars and background imagery. If you allow users to upload their own images, be sure to add validation to the Upload File logic components to ensure only approved formats that you’re prepared to support are brought it.

Thanks, Paul. :slight_smile:

1 Like

Thanks for this Paul!

So what I’m getting in short is that we retrieve the record (GET) first and then update record (PUT). Instead of jumping right into update after the initial registration (POST).

For your RUN TEST in GET, what did you put as your id?
I tested it with a random objectId as the Id. It was a success! And I set the schema from response.

Moving forward to the PUT, I tried running it like the 1st screenshot and the error returned after binding it with object with properties. Is there something I need to change on relative path, and HTTP, URL placeholder, and also for the record properties?

Very much appreciate your help!! :vulcan_salute:

For full context, in PUT, I set my schema manually to ‘username’ and ‘birthdate’, as shown below.
Even before running anything in GET.

not sure if this is right tho.

Hi There

With the GET, yes, you can use the objectId…I have been using ownerId but as you can see in ‘Users’, they both have the same value. I asked on a different topic what is the difference between objectId v ownerId, and got a detailed response…just haven’t had time to digest the info.
With the PUT not working, you haven’t set the URL place holder to add ownerId to the end of the URL…that looks like the error.
To to test the URLs, and there are more complex ways to do it, I just drop it in to a web browser and see if it returns anything. If it doesn’t, you know the API is not going to work.

Hi Troy
I still haven’t fully understood the difference between the ‘request’ and ‘response’ schema but from the help I have received, I am 95% sure you also use ‘request’ (in additional to ‘response’) when you are sending info to the database, for example, in an UPDATE(PUT) or CREATE(POST). And I think that is why you wont need the ‘request’ schema in your GET RECORD(GET). That is how I rationalised why mine works, because I didn’t set it. And if you go back and check out the create user API you created (probably by following the same documentation I used…), you did use the ‘request’ schema…again, I think that is because you are sending info to Backendless, rather than just retrieving it.

Thanks for all the guidance Paul! I still am stuck :laughing: for hours in trial and error

Over at the RUN TEST side, running the test is successful with these:

However, when it comes to testing in the mobile app:

Screenshot 2021-04-03 at 4.11.22 PM

In regard to the id component, I have tried ‘App variable’s currentUser’, ‘Output receive event’, ‘Data variable’s userUpdate1.objectId’, ‘Page variable’s objectId’, ‘formula’s self.id’, ‘pageVars.objectId’, ‘pageVars.currentUser’, ‘pageVar.objectId’.

I have the logic flow set up but also ran an error if the GET Record fails on mobile app.

The 2 main errors that return at the GET Record stage are ‘Missing required parameter: objectId’ or ‘error 8002/8004. Could not parse message. Headers GET’.

Correct me if I’m wrong, this GET function here is to get the objectId of the record I want to update. so that further down the logic flow, my PUT can update the page variables back to this object.

By any chance do you know what should I include in the ‘id’ component under the Resource Name to get the objectId?

Many thanks!

Hi Troy

Re the big picture, the GET is to bring back the values of each field in the data table (i.e. Users)…and the values you want are for a particular user which you identify using the ownerId (or objectId)…same value so somewhat irrelevant which one you use. I set that using an app variable which I populate when the user logs in…see below. Note, ignore the user-token…I was led to believe I needed that, but it isn’t used anywhere.

The PUT is to update these values, and again, you will identify the user by that ownerId.

As to the screenshots with the binding, it looks really familiar and I tried that and failed to get it working. It makes sense…the binding…but I also couldn’t get it to work. So I had to make it slightly more convoluted. I created page variables for each field that is pulled, and then after the GET in the logic, I set the value of each variable with a field.

And then on my profile page, I bind each component to the data variable! I think this is where the importance of the data type comes into it…the page variables are all type = text, the values in the schema are all text except for the date and time ones. Finally, I am then pulling them into component = Input Fields which display the text OK (I cannot recall but I had trouble getting different components to work, but I am winning with the Input Fields!!!).

Also, note you have to bind the ownerId in the data variable on the page where you are pulling these values…this bit took me a while to figure out.

All this stuff you are struggling with, I was struggling with two weeks ago!? Hopefully one of these little pieces of info will get you over the line. And then we can talk PUT!

Yo Paul, thanks for that again!

Will check to see if I can jump across this hurdle. thought this was pretty fundamental, thought I could get over it easily but apparently not.
just curious why appgyver doesn’t have that in their documentation.

not sure if you seen this before: Pass Data Variables (Object) between pages? - #2 by SeanHoots

I tried, but the error says that I have missing parameter: id

Feels so close yet so far. lol will see where needs to be corrected.

@Paul_Mc @Dominik_Greene

Hey guys, solved it. turns out it was really something simple.

Created app variable as currentUser (value = text)

After Create Record on the register page, I connected to it a Set App variable tab. Variable name was alrdy currentUser. Assigned value: outputs[“Create record”].response.objectId (using formula).

For the next page, I didn’t even include Get Record. Bcos i assumed that having app variable as currentUser would alrdy pass the objectId along.

Then, for Update Record, my structure is as seen as the screenshot below:
Screenshot 2021-04-05 at 6.39.02 PM

I find that connecting your app to debugger helps a lot. Bcos you can see everything that’s happening and you know where the screw up is.

Cheers!