Class: NS1Request

NS1.NS1Request

Class representing all HTTP requests to the NS1 API. Uses the superagent lib to be cross compatible w/ Node.js and Browser based environment.

Constructor

new NS1Request(method, uri, query, files)

Creates a request and returns a promise object for that request.
Parameters:
Name Type Description
method String The HTTP verb to use in this request e.g. get, post, etc. Must be lower case.
uri String The URI to query against the base API URL
query Object Any parameters to be sent in the query string for GET requests or in the req body for others
files Object/FormData Key / value mapped object containing file paths for uploads, or a FormData object if on the browser.
Source:

Methods

(static) get_api_key() → {String}

Returns the current API key being used by the class.
Source:
Returns:
The API key
Type
String

(static) get_api_url() → {String}

Returns the current API url base being used.
Source:
Returns:
The API url
Type
String

(static) set_api_key(key)

Sets the API key used by the class.
Parameters:
Name Type Description
key String The API key supplied by the user
Source:

(static) set_api_url(root)

Sets the API url used by the class.
Parameters:
Name Type Description
root String The URL to set as the base for API calls
Source: