Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dreamfactory user creation
$user = [
'name' => $postData['email'],
'email' => $postData['email'],
'first_name' => $postData['firstname'],
'last_name' => $postData['lastname'],
'password' => $postData['password']
];
$data = [
'resource' => [$user]
];
// now create the API user
$ch = curl_init("{$apiBaseUrl}/api/v2/system/user?session_token={$token['session_token']}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$response = curl_exec($ch);
curl_close($ch);
$resource = json_decode($response, true);
$userId = $resource['resource'][0]['id'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.