Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 3.18 KB

File metadata and controls

68 lines (48 loc) · 3.18 KB

RESTRequest

Overview

Available Operations

submitRestRequest

This generic operation can be used to execute any valid REST request. The results are returned directly when the request is complete. To explore the available REST operations, see the REST API Reference.

Example Usage

package hello.world;

import com.thetradedesk.workflows.Workflows;
import com.thetradedesk.workflows.models.components.CallRestApiWorkflowInput;
import com.thetradedesk.workflows.models.components.RestApiMethodType;
import com.thetradedesk.workflows.models.errors.ProblemDetailsException;
import com.thetradedesk.workflows.models.operations.SubmitRestRequestResponse;
import java.lang.Exception;

public class Application {

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

        Workflows sdk = Workflows.builder()
                .ttdAuth(System.getenv().getOrDefault("WORKFLOWS_TTD_AUTH", ""))
            .build();

        CallRestApiWorkflowInput req = CallRestApiWorkflowInput.builder()
                .methodType(RestApiMethodType.GET)
                .endpoint("<value>")
                .dataBody("<value>")
                .build();

        SubmitRestRequestResponse res = sdk.restRequest().submitRestRequest()
                .request(req)
                .call();

        if (res.object().isPresent()) {
            System.out.println(res.object().get());
        }
    }
}

Parameters

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

Response

SubmitRestRequestResponse

Errors

Error Type Status Code Content Type
models/errors/ProblemDetailsException 400, 401, 403, 404 application/json
models/errors/APIException 4XX, 5XX */*