-
Notifications
You must be signed in to change notification settings - Fork 1
Unsupported Endpoints
Jay edited this page May 30, 2024
·
8 revisions
For unimplemented API endpoints, you can construct a generic request using a request.
$request = $api->getRequest()
->create($method, $endpoint, $headers = [], $bodyData = []);
$response = $api->sendRequest($request);
The response object implements a PSR-7 response, Psr\Http\Message\ResponseInterface
, see https://docs.guzzlephp.org/en/stable/quickstart.html#using-responses for more information.
As the SupportPal API returns JSON, you will need to JSON decode the string.
$body = (string) $response->getBody();
$data = json_decode($body, true);
$request = $api->getRequest()
->create('GET', 'selfservice/comment');
$api->sendRequest($request);
$request = $api->getRequest()
->create('GET', 'selfservice/comment', [], ['status' => 0]);
$api->sendRequest($request);
$data = [
'text' => 'text',
'article_id' => 3,
'type_id' => 1,
'parent_id' => 1,
'status' => 3,
'notify_reply' => 0,
];
$request = $api->getRequest()
->create('POST', 'selfservice/comment', [], $data);
$api->sendRequest($request);
$request = $api->getRequest()
->create('DELETE', 'selfservice/comment/1');
$api->sendRequest($request);