📖
Rulecube documentation
v2.4
v2.4
  • Overview
  • Quick Start
  • Tutorial
    • Getting started
    • Create and Run Your First Ruleset
    • Use Constants and Methods
    • Create and Call Functions
    • Adding Testcases
    • Using Lookup Tables
    • Using Entities
    • Using Forms
  • How-to Guides
    • Logging in and Authorization
      • Activate Your Account From an Invitation
      • Log in to Rulecube
      • Change Your Password
      • Recover Your Password
      • Two-factor authentication (2FA)
      • Invite Other Users to Rulecube
      • Edit a User's Role
      • Delete a User
    • Ruleset Development
      • Create a Ruleset
      • Set the Input for a Ruleset
      • Create a Rule
      • Generate Alerts
      • Try out a Ruleset
      • Call a Ruleset from Your Software
      • Entities
        • Create an Entity
        • Drag and Drop a JSON Schema or XSD to create entities
        • Entity instantiation
        • Persisted Entities
      • Constants
        • Constant Tables
      • Functions
      • Built-in Functions
      • Create and Run a Testcase
      • Delete a Ruleset or Components
      • Debugging your Ruleset
    • Create a Workflow
      • Workflow step types
      • Working with documents in a workflow
    • Work with (Environment) Variables
    • Call a Ruleset via Its API From Postman
    • Creating input from JSON Schema
    • Use a Ruleset from Your Software
    • Ruleset Productivity Tips
    • Create an Ockto workflow
    • Alert aggregation
    • Forms
      • Introduction and overview
      • Create a Data table
  • Language Reference
    • Global
    • Array
    • Compression
    • Crypto
    • Date
    • Encryption (deprecated)
    • Finance
    • Http
    • Mail
    • MongoDB
    • Ockto
    • PDF
    • SQL
    • Statistics
    • System
    • UserStore
    • Workflow
Powered by GitBook
On this page
  1. Language Reference

Http

Collection of HTTP functions.

Methods

request

request(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})

Create a HTTP Request. Can be used to post or get data to and from a URL.

Parameters

url string

The URL.

options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }

Examples

Http.request('http://www.example.com/data.json')        // GET data from a URL
Http.request('http://www.example.com/api/person', {     // POST data to a URL
  method: 'post',
  headers: {
    'X-Auth-Token': 'secret_token'
  },
  data: {
    firstName: 'John',
    age: 30
  }
})
Http.request('http://www.example.com/api/big-data', {   // POST, but don't wait for result
  wait: false,
  method: 'post',
  data: {}
})

all

all(requests: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
}[])

Create multiple parallel HTTP requests and returns when all responses have been received. Responses are returned in an array in the same order as the requests.

Parameters

requests { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}[]

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }[]

Examples

Http.all([
  { url: 'http://www.example.com/data.json' }
  { url: 'http://www.example.com/api/add', method: 'post', data: { a: 1, b: 2 } }
])

get

get(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})

Create a HTTP GET Request.

Parameters

url string

The URL.

options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }

Examples

Http.get('http://www.example.com/data.json')

post

post(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})

Create a HTTP POST Request.

Parameters

url string

The URL.

options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }

Examples

Http.post('http://www.example.com/data.json')
Http.post('http://www.example.com/api/person', {
  data: {
    firstName: 'John',
    age: 30
  }
})

put

put(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})

Create a HTTP PUT Request.

Parameters

url string

The URL.

options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }

Examples

Http.put('http://www.example.com/data.json')
Http.put('http://www.example.com/api/person', {
  data: {
    firstName: 'John',
    age: 31
  }
})

delete

delete(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})

Create a HTTP DELETE Request.

Parameters

url string

The URL.

options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }

Examples

Http.delete('http://www.example.com/data.json')

head

head(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})

Create a HTTP HEAD Request.

Parameters

url string

The URL.

options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }

Examples

Http.head('http://www.example.com/data.json')

patch

patch(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})

Create a HTTP PATCH Request.

Parameters

url string

The URL.

options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}

Return type

{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }

Examples

Http.patch('http://www.example.com/data.json')
PreviousFinanceNextMail

Last updated 1 month ago

(optional) Options object - set headers, method and other properties.

Array of requests.

(optional) Options object - set headers, method and other properties.

(optional) Options object - set headers, method and other properties.

(optional) Options object - set headers, method and other properties.

(optional) Options object - set headers, method and other properties.

(optional) Options object - set headers, method and other properties.

(optional) Options object - set headers, method and other properties.

More information
More information
More information
More information
More information
More information
More information
More information