Kevin
Posts: 0
Joined: Sun Oct 07, 2012 7:58 pm

Mapping Request Parameters For Updating users in Parse

Hello!

Any idea how I can map parse request parameters for updating user information in my app?

Here's the example they give at https://parse.com/docs/rest#users-upd...

precode
curl -X PUT \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "X-Parse-Session-Token: pnktnjyb996sj4p156gjtp4im" \
-H "Content-Type: application/json" \
-d '{"phone":"415-369-6201"}' \
https://api.parse.com/1/users/g7y9tkhB7O
/code/pre

How do i dynamically put the user objectId on the URL?
Like in the example above "g7y9tkhB7O" is the user objectId on the URL https://api.parse.com/1/users/g7y9tkhB7O

I've tried using request parameter "where" and mapping it from a local storage variable and added this custom code return '{"objectId":"'+value+'"}';

But when i test my app on phone, the moment i hit the update button on the form, it shows the loader but gets stuck there forever.

Kevin
Posts: 0
Joined: Sun Oct 07, 2012 7:58 pm

Mapping Request Parameters For Updating users in Parse

Thanks Max. But how do i pick the value of the variable for example {objectId} which will be stored as a local storage variable when a user logs in and use it on the URL so that the user can update his details?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Mapping Request Parameters For Updating users in Parse

When you say pick.. do you mean save?

Kevin
Posts: 0
Joined: Sun Oct 07, 2012 7:58 pm

Mapping Request Parameters For Updating users in Parse

I mean how do i refer to the value because it will already be saved as a local storage variable.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Mapping Request Parameters For Updating users in Parse

You can use local storage API anywhere in your app:

localStoraget.getItem(name);

I hope I understand the question :)

Kevin
Posts: 0
Joined: Sun Oct 07, 2012 7:58 pm

Mapping Request Parameters For Updating users in Parse

Thank you Max that's exactly what I was looking for :)

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Mapping Request Parameters For Updating users in Parse

Sorry, it's:

localStorage.getItem(name);
localStorage.setItem(name, value);

http://www.webmonkey.com/2011/04/how-...

Kevin
Posts: 0
Joined: Sun Oct 07, 2012 7:58 pm

Mapping Request Parameters For Updating users in Parse

Thanks it worked out well.

Return to “Issues”