(shortURLs)
REST APIs for managing short URLs
- create - Shorten a URL.
Shorten a URL.
declare(strict_types=1);
require 'vendor/autoload.php';
use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;
$security = new Shared\Security(
apiKey: '<YOUR_API_KEY_HERE>',
);
$sdk = SpeakeasyClientSDK\SDK::builder()->setSecurity($security)->build();
$request = new Operations\CreateRequestBody(
url: 'https://probable-heating.com/',
);
$response = $sdk->shortURLs->create(
request: $request
);
if ($response->shortURL !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CreateRequestBody | ✔️ | The request object to use for the request. |
Error Type | Status Code | Content Type |
---|---|---|
Errorors\SDKException | 4XX, 5XX | */* |