Page 1 of 1

Optional Parameters in REST

Posted: Wed Oct 23, 2013 4:40 pm
by William Bradee

I added an email column to Users data. Now I want to update it. So I let the user update the email address. But they may not want to update the password.

How do I use the Service call to omit password if it is blank in modify settings?

Or, if I just leave it off the rest service, can I add the password attribute to the REST call with Javascript if the user wants to change it?


Optional Parameters in REST

Posted: Wed Oct 23, 2013 4:43 pm
by maxkatz

Parameters that are not present in the request will not be updated.


Optional Parameters in REST

Posted: Wed Oct 23, 2013 4:51 pm
by William Bradee

yes, but if I map password from an input field, and it is blank, it is sent blank. So it is sent to the database as "".

I want to have the parameter omitted.

But I think I will create another service just to set the password and only invoke it if the password is set.


Optional Parameters in REST

Posted: Wed Oct 23, 2013 5:10 pm
by maxkatz

I think if the parameter is there..it will get updated. It's easy to test.


Optional Parameters in REST

Posted: Wed Oct 23, 2013 6:40 pm
by William Bradee

The two services approach worked: One for all user parameters except password, and one for password.


Optional Parameters in REST

Posted: Wed Oct 23, 2013 7:08 pm
by Kateryna Grynko

William,

Glad you have it working!