---
title: "Raw client"
slug: "raw-client-1523471"
abstract: "Overview of the JavaScript SDK raw client used to allow custom HTTP or HTTPS requests to Content Hub."
---
# Raw client

The raw client allows custom HTTP or HTTPS requests to Sitecore Content Hub, while still being authenticated and impersonated like any other action in the SDK. Any custom HTTP clients or delegating handlers are still used and events are still fired.

## Built-in requests

The client supports the following requests:

- `GET`
- `PUT`
- `POST`
- `DELETE`

The following snippet will fetch an entity with an ID of `1000`, and directly read it as an `EntityResource`, which is the data model for the REST API.

```javascript
import { ResponseMessage } from "@sitecore/sc-contenthub-webclient-sdk/dist/clients/response-message";

var response: ResponseMessage = await client.raw.getAsync("http://localhost:8080/api/entities/1000");
if (response.isSuccessStatusCode) {
  //custom code around response.content
}

```

The `ReadAsJsonAsync` method can be imported from `Stylelabs.M.Sdk.WebClient.Http`.

Custom headers can also be passed as an optional second parameter.

## Full control over requests

It is also possible to have full control over the request using the `SendAsync` method, for example for verbs that are not built-in. This method requires a factory function that returns a `HttpRequestMessage`. A factory function is needed so that the message can be retried on failures, because this requires a new message object.

> [!note]
> Note that no results from the raw client will be processed. No exceptions will be thrown when an unsuccessful status code is returned. This will need to be done manually. Some useful members on the `HttpResponseMessage` are the `EnsureSuccessStatusCode` method and `IsSuccessStatusCode` property.