OpenVeo REST NodeJS client API

API Docs for: 4.0.0
Show:

Request

Summary

Creates a REST request which can be executed / aborted.

Constructor

Request

Syntax

Request

(
  • protocol
  • [options]
  • [body]
  • [timeout=10000]
  • [multiparted=false]
)

Summary

Parameters:

  • protocol String

    The protocol to use for the request (either 'http' or 'https')

  • [options] Object optional

    The complete list of http(s) options as described by NodeJS http.request documentation. More headers can be added when executing the request.

  • [body] String | Object optional

    The request body

  • [timeout=10000] Number optional

    Maximum execution time for the request (in ms), set it to Infinity for a request without limits

  • [multiparted=false] Boolean optional

    true to send body as multipart/form-data

Methods

abort

Syntax

abort

() Promise async

Summary

Aborts the request.

Returns:

Promise:

Promise resolving when request has been aborted, promise is rejected if it takes too long to abort the request

execute

Syntax

execute

(
  • [headers]
)
Promise async

Summary

Executes the request.

Be careful, if request is executed while still running, the running one will be aborted.

Parameters:

  • [headers] Object optional

    A list of http(s) headers. Headers will be merged with Request headers set in the constructor

Returns:

Promise:

Promise resolving with request's response as an Object, all request's responses are considered success, promise is rejected only if an error occured during the transfer or while parsing the reponse's body (expected JSON)

Properties

abortTimeout

Syntax

abortTimeout

Number

Summary

Maximum time to wait until the request is aborted (in ms).

Default: 2000

attempts

Syntax

attempts

Number

Summary

The number of attempts made on this request.

Default: 0

body

Syntax

body

String final

Summary

The request body.

executionTimeout

Syntax

executionTimeout

Number

Summary

Maximum execution time for the request (in ms).

Default: 10000

isRunning

Syntax

isRunning

Boolean

Summary

Indicates if request is actually running.

Default: false

multiparted

Syntax

multiparted

Boolean

Summary

Indicates if request body must be sent as multipart/form-data.

Default: false

options

Syntax

options

Object final

Summary

Request options.

protocol

Syntax

protocol

String final

Summary

Request protocol either "http" or "https".

request

Syntax

request

ClientRequest

Summary

The HTTP(S) request.