# SamApiLib PHP library to ease requesting SAM via his REST API
Copy the SamApiLib folder into your autoload library older.
Then you can simply use it with :
use SamApiLib\SamApi;
use SamApiLib\Archive;
$sam_api = new SamApi("base_url", "api_token");
$sam_archive_api = new Archive($sam_api);
$archives = $sam_archive_api->read();
var_dump($archives);
array(89) {
[0]=>
array(50) {
["description"]=>
string(2) "{}"
["text"]=>
string(39) "BulletinDePaye_123456789012345_2022-03 "
["archiveId"]=>
string(22) "SAM_rak4z8-1xxw-7v88fo"
["archiverArchiveId"]=>
string(20) "FR094080_2022_AE0001"
["originatorArchiveId"]=>
NULL
["depositorArchiveId"]=>
NULL
["archiveName"]=>
string(38) "BulletinDePaye_123456789012345_2022-03"
["filePlanPosition"]=>
NULL
["originatingDate"]=>
NULL
["archivalProfileReference"]=>
NULL
["serviceLevelReference"]=>
string(16) "serviceLevel_002"
["archivalAgreementReference"]=>
NULL
["retentionRuleCode"]=>
NULL
["retentionStartDate"]=>
string(10) "2022-04-19"
["retentionDuration"]=>
NULL
["finalDisposition"]=>
NULL
["disposalDate"]=>
NULL
["retentionRuleStatus"]=>
NULL
["accessRuleCode"]=>
NULL
["accessRuleDuration"]=>
NULL
["accessRuleStartDate"]=>
NULL
["accessRuleComDate"]=>
NULL
["classificationRuleCode"]=>
NULL
["classificationRuleDuration"]=>
NULL
["classificationRuleStartDate"]=>
NULL
["classificationEndDate"]=>
NULL
["classificationLevel"]=>
NULL
["classificationOwner"]=>
NULL
["originatorOrgRegNumber"]=>
string(2) "rh"
["originatorOwnerOrgId"]=>
string(4) "ACME"
["originatorOwnerOrgRegNumber"]=>
string(4) "ACME"
["depositorOrgRegNumber"]=>
NULL
["archiverOrgRegNumber"]=>
string(3) "GIC"
["userOrgRegNumbers"]=>
NULL
["depositDate"]=>
string(25) "2022-04-18T22:54:44+00:00"
["lastCheckDate"]=>
string(25) "2022-09-29T14:45:07+00:00"
["lastDeliveryDate"]=>
NULL
["lastModificationDate"]=>
NULL
["lifeCycleEvent"]=>
NULL
["status"]=>
string(9) "preserved"
["fullTextIndexation"]=>
string(4) "none"
["descriptionClass"]=>
NULL
["descriptionObject"]=>
array(0) {
}
["fileplanLevel"]=>
NULL
["storagePath"]=>
string(73) "/SAM/ACME/rh/_archivalProfileReference_/2022/04/19/SAM_rak4z8-1xxw-7v88fo"
["processingStatus"]=>
NULL
["parentArchiveId"]=>
NULL
["contents"]=>
NULL
["digitalResources"]=>
NULL
["archiveRelationship"]=>
NULL
}
[1]=>
...