AppMachine Help Center

How can we help you?

Follow

AppMachine API - Step 6-8: Edit Profile

Previous steps taken

  • We’ve built 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

Step 6: Let the user edit/update their profile

Maybe you want your users to update information in their profile. So how do we do that?

  • Add another Web Service block
  • Select AppMachine as the provider
  • Select “PUT - Updates data in a data store

  • Fill in the name of your datastore (customers) and select the “id” from our user from the dropdown. (in this case it’s “Make Profile → id”). AppMachine will use the “internal name” of our web service. in this case it will be shown as {Dataprovider7._id}.

  • You will have to fill in at least one field in order for the web service to be executed. I picked the first field in our data store and this is “firstName”
  • Click Next and you will see that the web service executed successfully.
  • This is very important that the output state "true". If you get "false" you Object ID you have selected is wrong and you should re-check. The web service will not work if you continue.

  • Name your block “Edit Profile” and click Finish

  • If you have not done this already, drag this block under the “info” block of “My Profile”.

 

Step 7: Connecting the Edit Profile button in the profile screen

  • Connect the Edit Profile button in the “My Profile → Info” block.
  • Go to the Logic tab in the Info block of “My Profile”

  • Click on the EditProfileBtn.Click and select the Goto option.

  • Select the Edit Profile Block from the dropdown and click Finish

  • You can make your form the way you want to. Ours looks like this.

 

Step 8: Show the current profile

You can add text fields and connect the fields to show the user data like this.

You can repeat these steps for every field you have.

Summary

  • (PUT) Added the web service for updating the user their profile
  • Connected the correct id from the datastore so we will update the current user their profile
  • Connected the “Edit profile” button in the “info” block of “My Profile” block to go to the “Edit Profile” block in the Logic tab
  • Made a layout for the Edit Profile block and show the current profile data.
  • Next step is to actually update the new profile info back to the data store.

 

 

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

Comments

  • Avatar
    Joost de Graaf

    Nice!

  • Avatar
    Folami Harrison

    I can't get the profile to edit and the image doesn't show up just a blank space on the profile. Please help

Powered by Zendesk