Skip to main content

# IHttp

Provides methods to make call-outs to to external systems via HTTPS. By exposing this object from the host, it ensures that the call will bear the "Origin" header of the host application. This is critical for situations where the guest's code is running in a strict-mode sandbox (where the "allowSameOrigin" flag is false).

## Extends​

- `IScriptingObject`

## Methods​

### _dispose()?​

    optional _dispose(): void;

#### Returns​

`void`

#### Inherited from​

`IScriptingObject`.`_dispose`

### _toJSON()​

    _toJSON(): RemotingScriptingObject;

#### Returns​

`RemotingScriptingObject`

#### Inherited from​

`IScriptingObject`.`_toJSON`

### delete()​

    delete(url: string, headersOrAccessToken?: string | Record<string, string>): Promise<Response>;

delete http request

#### Parameters​

##### url​

`string`

url to make the call to

##### headersOrAccessToken?​

`string` | `Record`<`string`, `string`>

http headers object or access token to be used for the call

#### Returns​

`Promise`<`Response`>

http response object

#### Throws​

error if the http call fails with non 2xx status code

### get()​

    get(url: string, headersOrAccessToken?: string | Record<string, string>): Promise<Response>;

get http request

#### Parameters​

##### url​

`string`

url to make the call to

##### headersOrAccessToken?​

`string` | `Record`<`string`, `string`>

http headers object or access token to be used for the call

#### Returns​

`Promise`<`Response`>

http response object

#### Throws​

error if the http call fails with non 2xx status code

### patch()​

    patch(
       url: string,
       headersOrAccessToken?: string | Record<string, string>,
    content?: string | Record<string, string>): Promise<Response>;

patch http request

#### Parameters​

##### url​

`string`

url to make the call to

##### headersOrAccessToken?​

`string` | `Record`<`string`, `string`>

http headers object or access token to be used for the call

##### content?​

`string` | `Record`<`string`, `string`>

#### Returns​

`Promise`<`Response`>

http response object

#### Throws​

error if the http call fails with non 2xx status code

### post()​

    post(
       url: string,
       headersOrAccessToken?: string | Record<string, string>,
    content?: string | Record<string, string>): Promise<Response>;

post http request

#### Parameters​

##### url​

`string`

url to make the call to

##### headersOrAccessToken?​

`string` | `Record`<`string`, `string`>

http headers object or access token to be used for the call

##### content?​

`string` | `Record`<`string`, `string`>

#### Returns​

`Promise`<`Response`>

http response object

#### Throws​

error if the http call fails with non 2xx status code

### put()​

    put(
       url: string,
       headersOrAccessToken?: string | Record<string, string>,
    content?: string | Record<string, string>): Promise<Response>;

put http request

#### Parameters​

##### url​

`string`

url to make the call to

##### headersOrAccessToken?​

`string` | `Record`<`string`, `string`>

http headers object or access token to be used for the call

##### content?​

`string` | `Record`<`string`, `string`>

#### Returns​

`Promise`<`Response`>

http response object

#### Throws​

error if the http call fails with non 2xx status code

## Properties​

### id​

    readonly id: string;

#### Inherited from​

`IScriptingObject`.`id`

### objectType​

    readonly objectType: string;

#### Inherited from​

`IScriptingObject`.`objectType`