npm package: @marturion/suitetalk
Description: A small helper library for assising communication with Netsuite Rest Web Services
Author: Marturion Electronics Ltd
Latest version: 1.0.0

[marturion-suitetalk-01](../README.md) / [Exports](../modules.md) / NetsuiteRest

# Class: NetsuiteRest

Netsuite Rest Client

**`description`** Helps facilitate communications with Netsuite Suitetalk Web Services
```typescript
const netsuiteRestOptions: INetsuiteRestOptions = {
 // Populate with Authentication Keys
}

// Setup Netsuite Rest Client
const NetsuiteClient: NetsuiteRest = new NetsuiteRest(netsuiteRestOptions)

// Setup request options
const netsuiteRequestOptions: INetsuiteRequestOptions = {
   path: 'query/v1/suiteql',
   method: "POST",
   body: JSON.stringify(requestBody),
}

 // Perform the request
 NetsuiteClient.Request(netsuiteRequestOptions);
```

## Table of contents

### Constructors

- [constructor](NetsuiteRest.md#constructor)

### Properties

- [algorithm](NetsuiteRest.md#algorithm)
- [baseUrl](NetsuiteRest.md#baseurl)
- [consumerKey](NetsuiteRest.md#consumerkey)
- [consumerSecret](NetsuiteRest.md#consumersecret)
- [realm](NetsuiteRest.md#realm)
- [token](NetsuiteRest.md#token)
- [tokenSecret](NetsuiteRest.md#tokensecret)

### Methods

- [Request](NetsuiteRest.md#request)

## Constructors

### constructor

• **new NetsuiteRest**(`options`)

Netsuite Rest Contructor

**`argument`** INetsuiteRestOptions

#### Parameters

| Name | Type |
| :------ | :------ |
| `options` | [`INetsuiteRestOptions`](../interfaces/INetsuiteRestOptions.md) |

#### Defined in

[NetsuiteRest.ts:82](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L82)

## Properties

### algorithm

• `Private` **algorithm**: `string` = `"HMAC-SHA256"`

Algorithm to be used for Hashing Functionality

#### Defined in

[NetsuiteRest.ts:35](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L35)

___

### baseUrl

• `Private` **baseUrl**: `string`

Netsuite URL to override realm,  If passing a baseURL
the realm is still needed for authentication

#### Defined in

[NetsuiteRest.ts:76](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L76)

___

### consumerKey

• `Private` **consumerKey**: `string`

Netsuite integration record consumer key

**`see`** [Integration Record Oracle Docs](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/bridgehead_4249032125.html)

#### Defined in

[NetsuiteRest.ts:41](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L41)

___

### consumerSecret

• `Private` **consumerSecret**: `string`

Netsuite integration record consumer secret key

**`see`** [Integration Record Oracle Docs](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/bridgehead_4249032125.html)

#### Defined in

[NetsuiteRest.ts:47](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L47)

___

### realm

• `Private` **realm**: `string`

Netsuite account id
```typescript
// if production
XXXXXX - a number of 6 digits or more
// if Sandbox
XXXXXX_SB or XXXXXX_SB1
```

#### Defined in

[NetsuiteRest.ts:70](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L70)

___

### token

• `Private` **token**: `string`

Netsuite user access token for token based authentication

**`see`** [https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4254975694.html](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4254975694.html)

#### Defined in

[NetsuiteRest.ts:53](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L53)

___

### tokenSecret

• `Private` **tokenSecret**: `string`

Netsuite user access secret for token based authentication
* @see [https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4254975694.html](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4254975694.html)

#### Defined in

[NetsuiteRest.ts:59](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L59)

## Methods

### Request

▸ **Request**(`options`): `Promise`<`AxiosResponse`<`any`, `any`\>\>

Perform a Request to Netsuite Rest Web Services
Also supports using suiteQL for requests

**`example`**
```typescript
// Setup Netsuite Client
const NetsuiteClient: NetsuiteRest = new NetsuiteRest(netsuiteRestOptions);

// Setup request options
const netsuiteRequestOptions: INetsuiteRequestOptions = {
   path: 'query/v1/suiteql',
   method: "POST",
   body: JSON.stringify(requestBody),
}

// Peform Request
NetsuiteClient.Request(netsuiteRequestOptions);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | [`INetsuiteRequestOptions`](../interfaces/INetsuiteRequestOptions.md) | INetsuiteRequestOptions |

#### Returns

`Promise`<`AxiosResponse`<`any`, `any`\>\>

#### Defined in

[NetsuiteRest.ts:114](https://gitlab.com/marturion/library/marturion-suitetalk-01/-/blob/dc0486a/src/NetsuiteRest.ts#L114)