Skip to main content

http@5.1.0

Functions

del(path, params, callback)
get(path, params, callback)
parseXML(body, script)
patch(path, params, callback)
post(path, params, callback)
put(path, params, callback)
request(params)

del

del(path, params, callback) ⇒ Operation Make a DELETE request

Kind: global function
Access: public

ParamTypeDescription
pathstringPath to resource
paramsobjectBody, Query, Headers and Auth parameters
callbackfunction(Optional) Callback function

Example

del(`/myendpoint/${state => state.data.id}`, {
headers: {'content-type': 'application/json'}
})

get

get(path, params, callback) ⇒ Operation Make a GET request

Kind: global function
Access: public

ParamTypeDescription
pathstringPath to resource
paramsobjectQuery, Headers and Authentication parameters
callbackfunction(Optional) Callback function

Example

get('/myEndpoint', {
query: {foo: 'bar', a: 1},
headers: {'content-type': 'application/json'},
authentication: {username: 'user', password: 'pass'}
})

parseXML

parseXML(body, script) ⇒ Operation Parse XML with the Cheerio parser

Kind: global function
Access: public

ParamTypeDescription
bodyStringdata string to be parsed
scriptfunctionscript for extracting data

Example

parseXML(body, function($){
return $("table[class=your_table]").parsetable(true, true, true);
})

patch

patch(path, params, callback) ⇒ Operation Make a PATCH request

Kind: global function
Access: public

ParamTypeDescription
pathstringPath to resource
paramsobjectBody, Query, Headers and Auth parameters
callbackfunction(Optional) Callback function

Example

patch('/myEndpoint', {
body: {'foo': 'bar'},
headers: {'content-type': 'application/json'},
authentication: {username: 'user', password: 'pass'}
})

post

post(path, params, callback) ⇒ operation Make a POST request

Kind: global function
Access: public

ParamTypeDescription
pathstringPath to resource
paramsobjectBody, Query, Headers and Authentication parameters
callbackfunction(Optional) Callback function

Example

post('/myEndpoint', {
body: {'foo': 'bar'},
headers: {'content-type': 'application/json'},
authentication: {username: 'user', password: 'pass'}
})

put

put(path, params, callback) ⇒ Operation Make a PUT request

Kind: global function
Access: public

ParamTypeDescription
pathstringPath to resource
paramsobjectBody, Query, Headers and Auth parameters
callbackfunction(Optional) Callback function

Example

put('/myEndpoint', {
body: {'foo': 'bar'},
headers: {'content-type': 'application/json'},
authentication: {username: 'user', password: 'pass'}
})

request

request(params) ⇒ Operation Make a request using the 'request' node module. This module is deprecated.

Kind: global function

ParamTypeDescription
paramsobjectQuery, Headers and Authentication parameters

Example

request(params);