Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philicious/680e785a8f32cb7cb3a52b668f01dfd8 to your computer and use it in GitHub Desktop.
Save philicious/680e785a8f32cb7cb3a52b668f01dfd8 to your computer and use it in GitHub Desktop.
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