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

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’, ‘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.