Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 2.02 KB

File metadata and controls

62 lines (42 loc) · 2.02 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;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->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 */*