# Low-level HTTP Requests

In addition to the high-level APIs **`.create()`**, **`.read()`**, **`.update()`**, **`.delete()`**, to perform low-level HTTP requests, the Java Client Libraries include:

* [Request.Builder](https://api.docs.inrupt.com/docs/developer-tools/api/java/inrupt-client/latest/com/inrupt/client/Request.Builder.html) to build HTTP requests.
* [Request.BodyPublishers](https://api.docs.inrupt.com/docs/developer-tools/api/java/inrupt-client/latest/com/inrupt/client/Request.BodyPublishers.html) to handle request body payloads.
* **`.send()`** method in [SolidSyncClient](https://api.docs.inrupt.com/docs/developer-tools/api/java/inrupt-client/latest/com/inrupt/client/solid/SolidSyncClient.html) and [SolidClient](https://api.docs.inrupt.com/docs/developer-tools/api/java/inrupt-client/latest/com/inrupt/client/solid/SolidClient.html) to send the request.
* [Response.BodyHandlers](https://api.docs.inrupt.com/docs/developer-tools/api/java/inrupt-client/latest/com/inrupt/client/Response.BodyHandlers.html) to handle response body payloads.

For example, the following uses the Java Client Library to create a **`PUT`** request to save a file to a Pod and send the request:

```java
import com.inrupt.client.Request;
import com.inrupt.client.Response;
import java.io.InputStream;
import java.io.IOException;
//...

// MultipartFile file = ...

try (final var fileStream = file.getInputStream()) {
    Request request = Request.newBuilder()
       .uri(URI.create("https://storage.example.com/some/resource"))
       .header("Content-Type", file.getContentType())
       .PUT(Request.BodyPublishers.ofInputStream(fileStream))
       .build();
    Response<Void> response = client.send(
       request,
       Response.BodyHandlers.discarding());

} catch (IOException e1) {
    e1.printStackTrace();
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inrupt.com/sdk/java-sdk/crud-data/appendix-low-level-http-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
