Skip to content

Latest commit

 

History

History
187 lines (132 loc) · 8.6 KB

File metadata and controls

187 lines (132 loc) · 8.6 KB

Requests

(requests())

Overview

REST APIs for retrieving request information

Available Operations

generateRequestPostmanCollection

Generates a Postman collection for a particular request. Allowing it to be replayed with the same inputs that were captured by the SDK.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.SDK;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.GenerateRequestPostmanCollectionRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GenerateRequestPostmanCollectionResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

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

        GenerateRequestPostmanCollectionRequest req = GenerateRequestPostmanCollectionRequest.builder()
                .requestID("<id>")
                .build();

        GenerateRequestPostmanCollectionResponse res = sdk.requests().generateRequestPostmanCollection()
                .request(req)
                .call();

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

Parameters

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

Response

GenerateRequestPostmanCollectionResponse

Errors

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

getRequestFromEventLog

Get information about a particular request.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.SDK;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.GetRequestFromEventLogRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetRequestFromEventLogResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

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

        GetRequestFromEventLogRequest req = GetRequestFromEventLogRequest.builder()
                .requestID("<id>")
                .build();

        GetRequestFromEventLogResponse res = sdk.requests().getRequestFromEventLog()
                .request(req)
                .call();

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

Parameters

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

Response

GetRequestFromEventLogResponse

Errors

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

queryEventLog

Supports retrieving a list of request captured by the SDK for this workspace. Allows the filtering of requests on a number of criteria such as ApiID, VersionID, Path, Method, etc.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.SDK;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.QueryEventLogRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.QueryEventLogResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

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

        QueryEventLogRequest req = QueryEventLogRequest.builder()
                .build();

        QueryEventLogResponse res = sdk.requests().queryEventLog()
                .request(req)
                .call();

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

Parameters

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

Response

QueryEventLogResponse

Errors

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