documents->get
documents->get(string $id): PoliPageDocumentDescriptor Retrieve a stored document’s descriptor with a fresh presigned URL. Use this when the URL handed back by $client->render->document(...) has expired (15-minute TTL).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
$id | string | required | (no description) |
Returns
Section titled “Returns”\PoliPage\DocumentDescriptor
Errors
Section titled “Errors”| Code | When |
|---|---|
DOCUMENT_NOT_FOUND | See [errors](../../../production/errors/) for the full description. |
INVALID_API_KEY | See [errors](../../../production/errors/) for the full description. |
GONE | See [errors](../../../production/errors/) for the full description. |
INTERNAL_ERROR | See [errors](../../../production/errors/) for the full description. |
Example
Section titled “Example”<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use PoliPage\PoliPage;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$documentId = $argv[1] ?? throw new RuntimeException('usage: documents-get.php <documentId>');
$doc = $client->documents->get($documentId);
echo "documentId: {$doc->documentId}\n";echo "pageCount: {$doc->pageCount}\n";echo "presignedPdfUrl: {$doc->presignedPdfUrl}\n";echo "expiresAt: {$doc->expiresAt}\n";