INTEGRATIONS / HTTP RECIPE

take it, meet Java.

The generated Java example uses the JDK HttpClient, a 45-second timeout and explicit status handling.

← All integrations

Your first connection.

  1. 01

    Use Java 11 or newer and export TAKEIT_BASE_URL and TAKEIT_API_KEY.

  2. 02

    Save the generated class as WaggleRequest.java and compile it with the standard JDK.

  3. 03

    Check statusCode and retain the response body and request ID when a call fails.

Build the request.

Set the environment variables in your terminal for these code examples. In automation tools, enter the URL and credentials in the tool’s own fields.

import java.net.URI;
import java.net.http.*;
import java.time.Duration;

var request = HttpRequest.newBuilder()
    .uri(URI.create(System.getenv("TAKEIT_BASE_URL").replaceAll("/$", "") + "/api/takeit/v1/scrape"))
    .timeout(Duration.ofSeconds(45))
    .header("Authorization", "Bearer " + System.getenv("TAKEIT_API_KEY"))
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"url\": \"https://example.com\"\n}"))
    .build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() / 100 != 2) throw new RuntimeException("take it HTTP " + response.statusCode() + ": " + response.body());
System.out.println(response.body());

This edits a code example. It does not send a request or use credits.

Run a request in your workspace
YOUR PRIVACY

Choose what works for you. You can reopen these settings from the footer at any time.