Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 2 KB

File metadata and controls

60 lines (39 loc) · 2 KB

ShortURLs

(shortURLs)

Overview

REST APIs for managing short URLs

Available Operations

create

Shorten a URL.

Example Usage

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
}

Parameters

Parameter Type Required Description
$request Operations\CreateRequestBody ✔️ The request object to use for the request.

Response

?Operations\CreateResponse

Errors

Error Type Status Code Content Type
Errorors\SDKException 4XX, 5XX */*