Hi,
I have a problems with my API system. I try to create a new user account with this script :
he result to an error : {"success":false,"code":8081,"error":"'name' or 'password' not set"}
Why ? My script looks good.
I have a problems with my API system. I try to create a new user account with this script :
Code:
$data = array("name" => "test", "password" => "testpass", "privileges" => 2147483647);
$data_string = json_encode($data);
$token_id = "uQHwuHsiaSI6IjIzNzQ5YzYzLWY1N2MtNGU2Ni05YzM0LWZiZmRhZTg4YzdlOSIsImIiOiI0Yzg0YWE5My1hYTcwLTRlNGItYjIzZi02OTZjOTBjNGRlYWMiLCJ1IjoiYWRtaW4iLCJ0IjoxNDYzMzkxOTQ2LCJzIjoiZTA3ZjdmMjM2ODgxMjkyMzRjODIwMjQ4MTM2MGQwOGQxMWRiZWFiN2M0M2IxY2MyYzgzODdhOThmNjBmNmZmMyJ9";
$ch = curl_init('http://149.202.46.113:4587/api/v1/bot/users');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Authorization: bearer $token_id",
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
print_r($result);
he result to an error : {"success":false,"code":8081,"error":"'name' or 'password' not set"}
Why ? My script looks good.