pleiades-decom/php-api-client

PHP library for PLEIADES API Client

dev-main 2023-03-22 12:17 UTC

This package is not auto-updated.

Last update: 2024-05-06 19:19:35 UTC


README

Library for accessing PLEIADES API.

Requires PHP 7.4 and above.

Basic usage examples

$api = new \PleiadesDecom\PhpApiClient\Client([
  "clientId" => "", // your app's client ID
  "clientSecret" => "", // your app's client secret
  "userName" => "", // name of the user to authenticate
  "userPassword" => "", // password of the user to authenticate
  "iamTokenEndpoint" => "", // OIDC endpoint address of IAM server
  "apiEndpoint" => "", // API server endpoint address
]);
$api->getAccessToken();
$api->setDatabase("testDatabase");
$records = $api->getRecords(["class" => "Database.Information"]);

Working with records

Create record

$createdRecordId = $api->createRecord([
  "class" => "Any.Valid.Class.Name",
  "content" => ["AnyValidContent" => "AnyValidValue"]
]);

Update record

$api->updateRecord(
  $recordId,
  [
    "class" => "Any.Valid.Class.Name",
    "content" => ["AnyValidContent" => "AnyValidValue"]
  ]
);

Delete record

$api->deleteRecord($recordId);

Get single record

$record = $api->getRecord($recordId);

Get list of records

$records = $api->getRecords(["class" => "Any.Valid.Class.Name"]);