I try make a user via a rest service with json data
A working code for login in same rest is:
Code: Select all
$user= $_GET["user"];
$password= $_GET["pw"];
$fields = array(
"operatorId" => "1",
"userName" => "$user",
'password' => "$password");
$json_data = json_encode($fields);
$post = file_get_contents('https://server:9090/user-service-rest/rest/users/',null,stream_context_create(array(
'http' => array(
'protocol_version' => 1.1,
'user_agent' => 'PHPExample',
'method' => 'POST',
'header' => "Content-type: application/json\r\n".
"Connection: close\r\n" .
"Content-length: " . strlen($json_data) . "\r\n",
'content' => $json_data,
),
)));The documentation shows following to create a user:
Code: Select all
{
"password" : "pwd",
"user" : {
"userName" : "RaoulDuke",
"operatorId" : "1",
"userInformation" : {
"billingAddress" : "Kungsgatan 1",
"city" : "Stockholm",
"country" : "Sweden"
}
}
}Regards
Brian Olsen