Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 2.23 KB

File metadata and controls

66 lines (45 loc) · 2.23 KB

ShortURLs

(shortURLs())

Overview

REST APIs for managing short URLs

Available Operations

create

Shorten a URL.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.CreateRequestBody;
import dev.speakeasyapi.javaclientsdk.models.operations.CreateResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        CreateRequestBody req = CreateRequestBody.builder()
                .url("http://limp-pastry.org")
                .build();

        CreateResponse res = sdk.shortURLs().create()
                .request(req)
                .call();

        if (res.shortURL().isPresent()) {
            // handle response
        }
    }
}

Parameters

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

Response

CreateResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*