| Qore NetSuiteRestClient Module Reference 1.0

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
NetSuiteRestClient::NetSuiteRestClient Class Reference

this class provides the REST client API for communication with NetSuite servers More...

Inheritance diagram for NetSuiteRestClient::NetSuiteRestClient:
[legend]

## Public Member Functions
| constructor (hash< auto > opts, *softbool do_not_connect)
| creates the object with the given options

## Public Attributes
const | DefaultAuthUrl = "https://{{account_id}}.netsuite.com/app/login/oauth2/authorize.nl"
| Default authorization request URL.
const | DefaultGrantType = "authorization_code"
| Default OAuth2 grant type.
const | DefaultLogoutUrl = "https://{{account_id}}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/logout"
| Default token logout / deauthorize URL.
const | DefaultNetSuitePingHeaders = ...
| Default NetSuite ping headers.
const | DefaultNetSuitePingMethod = "GET"
| Default NetSuite ping method.
const | DefaultOAuth2Scopes = ("rest_webservices",)
| Default OAuth2 scopes.
const | DefaultOptions = ...
| Default constructor options.
const | DefaultTokenUrl = "https://{{account_id}}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token"
| Default token request URL.
const | DefaultUrl = "https://{{account_id}}.suitetalk.api.netsuite.com/services/rest/record"
| Default REST URL.

## Protected Member Functions
| checkLogin (*reference< hash< auto > > info)
| Checks if a login is necessary; if so, then the login is performed.
*hash< auto > | getUpdateOptionsAfterLogin (hash< auto > h)
| Returns options to update after an OAuth2 login.
hash< auto > | oauth2Auth (hash< auto > login, *reference< hash< auto > > info, *bool refresh)
| Perform OAuth2 authentication.
| setOAuth2LoginInfo (hash< auto > h)
| Sets options from the OAuth2 login response on the local object.

## Static Protected Member Functions
static hash< auto > | getOptions (hash< auto > opts)
| returns options for NetSuiteRestClient::NetSuiteRestClient::constructor()

## Protected Attributes
string | account_id
| NetSuite account ID; can be auto-discovered.
string | oauth2_logout_url
| The OAuth2 logout / token deauthorization URL.

## Detailed Description

this class provides the REST client API for communication with NetSuite servers

You must use an OAuth2 token by setting the `token` and `oauth2_refresh_token` options; the following options need to be set as well:

- `oauth2_client_id:` the OAuth2 client ID
- `oauth2_client_secret:` the OAuth2 client secret

Then an external program has to guide the user through using the authorization_grant flow to get a token to use; this module does not implement that flow.

## Member Function Documentation

## ◆ constructor()

NetSuiteRestClient::NetSuiteRestClient::constructor | ( | hash< auto > | opts,
|  | *softbool | do_not_connect )

creates the object with the given options

Example:
  NetSuiteRestClient rest(opts);

Parameters

  opts | valid options are all the options for the RestClient class; note that the URL is set by default if not provided (see DefaultUrl)
  do_not_connect | if `False` (the default), then a connection will be immediately established to the remote server

Exceptions

  RESTCLIENT-ERROR | invalid option passed to constructor, unsupported data serialization, etc

## ◆ getUpdateOptionsAfterLogin()

*hash< auto > NetSuiteRestClient::NetSuiteRestClient::getUpdateOptionsAfterLogin | ( | hash< auto > | h | ) |
| protected

Returns options to update after an OAuth2 login.

Since
  RestClient 2.0

## ◆ oauth2Auth()

hash< auto > NetSuiteRestClient::NetSuiteRestClient::oauth2Auth | ( | hash< auto > | login,
|  | *reference< hash< auto > > | info,
|  | *bool | refresh )
| protected

Perform OAuth2 authentication.

Since
  RestClient 2.0

## ◆ setOAuth2LoginInfo()

NetSuiteRestClient::NetSuiteRestClient::setOAuth2LoginInfo | ( | hash< auto > | h | ) |
| protected

Sets options from the OAuth2 login response on the local object.

Since
  RestClient 2.0