User Related¶
Login¶
Request¶
| Field | Description |
|---|---|
| URL | http://localhost:8083/api/osinstall/v1/user/login |
| encode | UTF-8 |
| method | HTTP POST |
| payload | application/json |
Payload¶
| Field | Type | Required | Description |
|---|---|---|---|
| username | string | yes | username |
| password | string | yes | password |
Payload Sample¶
{
"Username": "admin",
"Password": "admin"
}
Code Sample (PHP)¶
<?php
$data = array(
"Username" => "admin",
"Password" => "admin",
);
$str = json_encode($data);
$ch = curl_init('http://localhost:8083/api/osinstall/v1/user/login');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($str))
);
$result = curl_exec($ch);
echo curl_error($ch);
echo $result;
?>
Response¶
| Field | Description |
|---|---|
| Status | success or failure |
| Content | user infomation and access token |
| Message | return message |
Sample Response Message¶
{
"Content": {
"ID": 1,
"Username": "admin",
"Name": "Super Administrator",
"Role": "Administrator",
"AccessToken": "097B55289D87C26FC33C2B0F7F80701D"
},
"Message": "Login Success",
"Status": "success"
}
Logout¶
Request¶
| Field | Description |
|---|---|
| URL | http://localhost:8083/api/osinstall/v1/user/logout |
| encode | UTF-8 |
| method | HTTP POST |
| payload | application/json |
Payload Sample¶
{
"AccessToken": "097B55289D87C26FC33C2B0F7F80701D"
}
Code Sample (PHP)¶
<?php
$data = array(
"AccessToken" => "097B55289D87C26FC33C2B0F7F80701D",
);
$str = json_encode($data);
$ch = curl_init('http://localhost:8083/api/osinstall/v1/user/logout');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($str))
);
$result = curl_exec($ch);
echo curl_error($ch);
echo $result;
?>
Sample Response Message¶
{
"Message": "User logout success",
"Status": "success"
}