(shortURLs())
REST APIs for managing short URLs
- create - Shorten a URL.
Shorten a URL.
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
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
request |
CreateRequestBody | ✔️ | The request object to use for the request. |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4XX, 5XX | */* |