📖
Rulecube documentation
v2.0
v2.0
  • 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
  • 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
        • Advanced topic: Entity instantiation
      • 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
  • Language Reference
    • Global
    • Finance
    • Http
    • Mail
    • MongoDB
    • SQL
    • Statistics
    • Workflow
    • System
    • Array
    • Date
Powered by GitBook
On this page
  • Methods
  • request
  • get
  • post
  • put
  • delete
  • head
  • patch
  1. Language Reference

Http

PreviousFinanceNextMail

Last updated 2 years ago

Collection of HTTP functions.

Methods

request

request(url: string, options?: { method?: any, headers?: any, 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 }, [x: any]: unknown })

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?: any, 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 }, [x: any]: unknown }

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

Return type

{ data: any, status: number, statusText: string, headers: Record<string, 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: {}
})

get

get(url: string, options?: { method?: any, headers?: any, 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 }, [x: any]: unknown })

Create a HTTP GET Request.

Parameters

url string

The URL.

options { method?: any, headers?: any, 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 }, [x: any]: unknown }

Return type

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

Examples

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

post

post(url: string, options?: { method?: any, headers?: any, 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 }, [x: any]: unknown })

Create a HTTP POST Request.

Parameters

url string

The URL.

options { method?: any, headers?: any, 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 }, [x: any]: unknown }

Return type

{ data: any, status: number, statusText: string, headers: Record<string, 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?: any, 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 }, [x: any]: unknown })

Create a HTTP PUT Request.

Parameters

url string

The URL.

options { method?: any, headers?: any, 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 }, [x: any]: unknown }

Return type

{ data: any, status: number, statusText: string, headers: Record<string, 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?: any, 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 }, [x: any]: unknown })

Create a HTTP DELETE Request.

Parameters

url string

The URL.

options { method?: any, headers?: any, 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 }, [x: any]: unknown }

Return type

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

Examples

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

head

head(url: string, options?: { method?: any, headers?: any, 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 }, [x: any]: unknown })

Create a HTTP HEAD Request.

Parameters

url string

The URL.

options { method?: any, headers?: any, 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 }, [x: any]: unknown }

Return type

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

Examples

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

patch

patch(url: string, options?: { method?: any, headers?: any, 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 }, [x: any]: unknown })

Create a HTTP PATCH Request.

Parameters

url string

The URL.

options { method?: any, headers?: any, 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 }, [x: any]: unknown }

Return type

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

Examples

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

(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