Sarina DuPont from Embarcadero has a new blog post in her BaaS component series for Delphi XE6 Firemonkey (previous post). In this blog post she covers how to send additional fields to the server besides the username and password on Android, IOS, and Windows (probably OSX as well). The format for the additional data is JSON and you can send as many additional fields as you need to using this method. This example uses Kinvey on the server side for accepting the signup information but you could also use Parse or any other supported provider. TBackendUsers is the component that you need to use to actually create the user account and send along the additional information. It also appears that the fields that you send along automatically get created on the server (you don’t have to create them first and then send them along as far as I can tell). You will notice how the TJSONObject component is used to automatically create the necessary JSON. Check out the sample source code and specifically the third parameter in the SignUpUser function:
procedure TSignUpForm.BtnSignUpClick(Sender: TObject);
var
LJSON: TJSONObject;
LLogin: TBackendEntityValue;
begin
LJSON := TJSONObject.Create;
try
LJSON.AddPair(’email’, EditEmail.Text);
LJSON.AddPair(’first_name’, EditFirstName.Text);
LJSON.AddPair(’last_name’, EditLastName.Text);
LJSON.AddPair(’age’, EditAge.Text);
BackendUsers1.Users.SignUpUser(EditUserName.Text, EditPassword.Text, LJSON, LLogin );
ShowMessage(’You are now signed up’);
finally
LJSON.Free;
end;
end;
Head over and check out the full blog post on sending extra signup data using the BaaS cloud components.