AppMachine Help Center

How can we help you?

Follow

AppMachine API - Step 4-5: Building Profile Form

Previous steps taken:

  • Added user authentication
  • Added web service for creating a profile
  • Already connected the {user:email} to the profile web service so that the email address, which the user has registered with, will be send to the API when they make a profile.
  • Checked if everything is setup right( Form / Developer tab → Custom Objects )

 

Step 4: Building your profile form

Build your form the way you want and fill in your profile. Click on the Submit button to add your profile to the API.

  • When you go to the Developer tab → Custom Objects → Customers, you will see the profile we’ve just created.

 

Step 5: Showing the user profile in your app

  • Add another web service block and select the AppMachine as the provider
  • This time select “GET - Returns data from data store

 

Insert the name of the datastore we just created. In this case our data store is called “customers

  • Click Next and you will see the data that is inside the data store

  • Check the box for “root” , after that name your block “My Profile” and click Finish. You can make the screen again as you want with an Edit button so the user can edit their profile if they want. This will be explained in the next tutorial.

At first you will get ALL the items in that data store, but we don’t want that. We want only the items for the logged in user to show, so how do we do that?

 

  • Go to your My Profile block

 

 

  • Click on the dataprovider dots and go to “Query” tab

 

  • Add to the “where” the following: email == '{user:email}'.
  • *Note this is case-sensative ( both field and value ). If {user:email} has the value 'johnny@appmachine.com' but in the DataStore it's stored as 'Johnny@apmachine.com', the filter will not return anything.

This will only get the items from the data store from our logged in user.

If everything went okay you will only have the data of the currently logged in user

 

Summary

  • We’ve build a profile form
  • (POST) Added a profile to our data store “customers” with the AppMachine API
  • (GET) Got all the data back from the data store “customers”
  • Filtered all the data with the “where” condition to only get the data from the currently logged in user.
  • Created a profile screen to show the currently logged in user their profile
  • Next step is for the user to edit (PUT)  their profile

 

 

 

 

 

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk