separated modifiers, added standard
This commit is contained in:
@@ -9,9 +9,9 @@ include_once plugin_dir_path(dirname(__FILE__)) . 'includes/html_helper.php';
|
||||
class APIgoatFetchAPI
|
||||
{
|
||||
|
||||
private $username = 'wp-behavior@apigoat.com';
|
||||
private $password = 'iDhj3wsyYs7WrrS';
|
||||
private $baseURI = 'https://x.apigoat.com/api/v1/';
|
||||
private $username = 'sysadmin';
|
||||
private $password = 'vezvez';
|
||||
private $baseURI = 'https://goat.local/p/goatcheese/api/v1/';
|
||||
private $jwt_pubkey = '9sKjdjuue8sSjwh6';
|
||||
private $jwt_alg = ['HS256'];
|
||||
private $client;
|
||||
@@ -21,12 +21,15 @@ class APIgoatFetchAPI
|
||||
{
|
||||
$this->client = new APIClient($this->baseURI);
|
||||
$this->clientOptions = [
|
||||
'verify' => true,
|
||||
'verify' => false,
|
||||
'content-Type' => 'application/json',
|
||||
'accept' => 'application/json',
|
||||
'debug' => false
|
||||
'debug' => false,
|
||||
'timeout' => 10
|
||||
];
|
||||
|
||||
//unset($_SESSION['APIgoat']);
|
||||
|
||||
if (!$this->authenticationValid()) {
|
||||
$this->authenticate();
|
||||
$this->saveCredentials();
|
||||
@@ -43,25 +46,20 @@ class APIgoatFetchAPI
|
||||
$clientOptions['query'] = [
|
||||
"query" => [
|
||||
"select" => [
|
||||
["behavior.name", "name"], ["code", "title"], ["description", "text"], "value", "example", "type", ["behavior_category.name", "category_name"]
|
||||
["behavior.name", "name"], ["code", "title"], ["description", "text"], "value", "example", "type", ["behavior_category.name", "category_name"], "group"
|
||||
],
|
||||
"filter" => [
|
||||
"behavior" => [
|
||||
0 => ["group", "Free"],
|
||||
1 => ["status", "Active"]
|
||||
]
|
||||
["status", "Active"]
|
||||
],
|
||||
"join" => ["behavior_category"],
|
||||
"limit" => 20,
|
||||
"recurse" => "behavior_file"
|
||||
],
|
||||
"debug" => true
|
||||
"join" => ["behavior_category"]
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
//$clientOptions['debug'] = true;
|
||||
$response = $this->client->get('Behavior', $clientOptions);
|
||||
|
||||
$body = json_decode($response->getBody()->getContents(), true);
|
||||
//$body['debug'][] = $clientOptions['query'];
|
||||
if ($response->getStatusCode() == 200) {
|
||||
return $body;
|
||||
} else {
|
||||
@@ -87,7 +85,8 @@ class APIgoatFetchAPI
|
||||
'u' => $this->username,
|
||||
'pw' => md5($this->password)
|
||||
],
|
||||
'debug' => false
|
||||
'debug' => false,
|
||||
'timeout' => 10
|
||||
];
|
||||
// authenticate on API to get token
|
||||
$response = $this->client->post('Authy/auth', $options);
|
||||
|
||||
Reference in New Issue
Block a user