---
title: ZEPETO.Multiplay.HttpService
slug: world-sdk-guide/zepetomultiplayhttpservice
docTags: 
createdAt: 2026-08-28T01:33:16.819Z
---

| Type                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [HttpContentType](./#httpcontenttype) | Enumeration of constants specifying the HTTP Content-Type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [HttpBodyType](./#httpbodytype)       | Type alias for HTTP Body content, which can be either plain text or a key-value object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [HttpHeader](./#httpheader)           | Type alias for HTTP Headers, representing a key-value object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [HttpErrorType](./#httperrortype)     | Enumeration of constants specifying reasons for failure in HTTP requests.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [HttpError](./#httperror)             | Represents an error that occurred during an HTTP request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [HttpResponse](./#httpresponse)       | Represents an HTTP Response.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [HttpService](./#httpservice)         | `HttpService` provides an API to establish HTTP connections with external web services and make requests. - Ensure using HTTPS protocol; HTTP is supported only in the development environment. - Requests are limited to ports 80 and 443. - The maximum size for request and response bodies is 16KB. - Keep requests per minute below 500 to avoid potential limitations on the World service due to excessive requests. - Requests will fail if external web services do not respond within 5 seconds. - Ensure that the Content-Type in response headers matches values defined in `HttpContentType` enum to prevent request failures. - Due to potential web request failures for various reasons, it's recommended to code defensively. |

## HttpContentType

`enum`

Enumeration of constants specifying the HTTP Content-Type.

| Name                  | Value                               | Description                                                |
| --------------------- | ----------------------------------- | ---------------------------------------------------------- |
| ApplicationJson       | "application/json"                  | Represents application/json content type.                  |
| ApplicationXml        | "application/xml"                   | Represents application/xml content type.                   |
| ApplicationUrlEncoded | "application/x-www-form-urlencoded" | Represents application/x-www-form-urlencoded content type. |
| TextPlain             | "text/plain"                        | Represents text/plain content type.                        |
| TextXml               | "text/xml"                          | Represents text/xml content type.                          |

## HttpBodyType

`delegate`

Type alias for HTTP Body content, which can be either plain text or a key-value object.

`string | { [key: string]: any; }`

## HttpHeader

`delegate`

Type alias for HTTP Headers, representing a key-value object.

`{ [key: string]: string | number; }`

## HttpErrorType

`enum`

Enumeration of constants specifying reasons for failure in HTTP requests.

| Name                  | Value                   | Description             |
| --------------------- | ----------------------- | ----------------------- |
| ERR\_ACCESS\_DENIED   | "ERR\_ACCESS\_DENIED"   | Error: Access denied.   |
| ERR\_LENGTH\_REQUIRED | "ERR\_LENGTH\_REQUIRED" | Error: Length required. |

## HttpError

`interface` · extends `Error`

Represents an error that occurred during an HTTP request.

### Properties

| Name    | Type     | Description                                              |
| ------- | -------- | -------------------------------------------------------- |
| message | `string` | Error message.                                           |
| code    | `string` | Error code defined as a value from `HttpErrorType` enum. |

## HttpResponse

`interface`

Represents an HTTP Response.

### Properties

| Name       | Type     | Description                                                                                                                                                                               |
| ---------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| statusCode | `number` | The status code of the response. Typically, 200 indicates a successful request.                                                                                                           |
| statusText | `string` | The status message corresponding to the status code. Typically, "OK" indicates a successful request.                                                                                      |
| response   | `string` | The body of the HTTP response, which may vary in format based on the response's Content-Type. It is recommended to use an appropriate parser based on the specific Content-Type received. |

## HttpService

`interface`

`HttpService` provides an API to establish HTTP connections with external web services and make requests.

- Ensure using HTTPS protocol; HTTP is supported only in the development environment.
- Requests are limited to ports 80 and 443.
- The maximum size for request and response bodies is 16KB.
- Keep requests per minute below 500 to avoid potential limitations on the World service due to excessive requests.
- Requests will fail if external web services do not respond within 5 seconds.
- Ensure that the Content-Type in response headers matches values defined in `HttpContentType` enum to prevent request failures.
- Due to potential web request failures for various reasons, it's recommended to code defensively.

### Methods

### getAsync

`getAsync(url: string, headers?: HttpHeader) → Promise<HttpResponse>`

Asynchronously performs an HTTP GET request. Throws `HttpError`.

| Parameter          | Type                        | Description                          |
| ------------------ | --------------------------- | ------------------------------------ |
| url                | `string`                    | The web address to send the request. |
| headers (optional) | [HttpHeader](./#httpheader) | HTTP request headers. (Optional)     |

**Returns:** `Promise<HttpResponse>` — `Promise` resolved with the `HttpResponse` object upon completion.

### postAsync

`postAsync(url: string, body: HttpBodyType, headers?: HttpHeader) → Promise<HttpResponse>`

Perform HTTP POST requests asynchronously. Throws `HttpError`.

| Parameter          | Type                            | Description                          |
| ------------------ | ------------------------------- | ------------------------------------ |
| url                | `string`                        | The web address to send the request. |
| body               | [HttpBodyType](./#httpbodytype) | Request body content.                |
| headers (optional) | [HttpHeader](./#httpheader)     | HTTP request headers. (Optional)     |

**Returns:** `Promise<HttpResponse>` — `Promise` resolved with the `HttpResponse` object upon completion.

### postAsync

`postAsync(url: string, body: HttpBodyType, httpContentType: HttpContentType, headers?: HttpHeader) → Promise<HttpResponse>`

Perform HTTP POST requests asynchronously. Throws `HttpError`.
When using this signature, if you add 'Content-Type' to headers, it will be overwritten by what is specified in `httpContentType`.

| Parameter          | Type                                  | Description                                |
| ------------------ | ------------------------------------- | ------------------------------------------ |
| url                | `string`                              | The web address to send the request.       |
| body               | [HttpBodyType](./#httpbodytype)       | Request body content.                      |
| httpContentType    | [HttpContentType](./#httpcontenttype) | Specifies the request Content-Type header. |
| headers (optional) | [HttpHeader](./#httpheader)           | HTTP request headers. (Optional)           |

**Returns:** `Promise<HttpResponse>` — `Promise` resolved with the `HttpResponse` object upon completion.
