new update
parent
1ef02380b9
commit
a7d2f88928
|
@ -83,6 +83,31 @@ class SASConnector{
|
|||
}
|
||||
}
|
||||
|
||||
public function put($route, $payload, $withAuth = true){
|
||||
|
||||
$json = json_encode($payload);
|
||||
$e_json = $this->aes::encrypt($json, 'abcdefghijuklmno0123456789012345');
|
||||
$res = $this->client->request('PUT',$this->base_url.$route,
|
||||
[
|
||||
'headers' => [
|
||||
'authorization' => 'Bearer '.$this->token
|
||||
],
|
||||
'json' => [
|
||||
'payload' => $e_json
|
||||
]
|
||||
]
|
||||
);
|
||||
if ($res->getStatusCode() >= 200 && $res->getStatusCode()< 400)
|
||||
return $res->getBody();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ $api = new SASConnector('172.16.12.108', 'admin', 'admin');
|
|||
$api->login();
|
||||
|
||||
|
||||
$res = $api->post('manager/128', [
|
||||
$res = $api->put('manager/128', [
|
||||
"enabled" => 1,
|
||||
"password" => null,
|
||||
"confirm_password" => null,
|
||||
|
@ -45,3 +45,13 @@ $res = $api->post('manager/128', [
|
|||
]);
|
||||
|
||||
print_r(json_decode($res));
|
||||
|
||||
//this is the expected response
|
||||
|
||||
//stdClass Object
|
||||
//(
|
||||
// [status] => 200
|
||||
// [message] => rsp_manager_updated
|
||||
//)
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ $api = new SASConnector('172.16.12.108', 'admin', 'admin');
|
|||
$api->login();
|
||||
|
||||
|
||||
$res = $api->post('profile/31', [
|
||||
$res = $api->put('profile/31', [
|
||||
"name" => "testprofiletest",
|
||||
"enabled" => 1,
|
||||
"price" => "12.22222",
|
||||
|
@ -86,3 +86,10 @@ $res = $api->post('profile/31', [
|
|||
]);
|
||||
|
||||
print_r(json_decode($res));
|
||||
//this is the expected response
|
||||
|
||||
//stdClass Object
|
||||
//(
|
||||
//[status] => 200
|
||||
//)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ $api = new SASConnector('172.16.12.108', 'admin', 'admin');
|
|||
$api->login();
|
||||
|
||||
|
||||
$res = $api->post('user/id', [
|
||||
$res = $api->put('user/id', [
|
||||
"enabled" => 1,
|
||||
"password" => null,
|
||||
"confirm_password" => null,
|
||||
|
@ -44,3 +44,10 @@ $res = $api->post('user/id', [
|
|||
]);
|
||||
|
||||
print_r(json_decode($res));
|
||||
//this is the expected response
|
||||
|
||||
//stdClass Object
|
||||
//(
|
||||
// [status] => 200
|
||||
//)
|
||||
|
||||
|
|
Loading…
Reference in New Issue