Passer au contenu principal

http@4.2.6

Functions

execute(operations)Operation

Execute a sequence of operations. Wraps language-common/execute, and prepends initial state for http.

get(path, params, callback)Operation

Make a GET request

post(path, params, callback)operation

Make a POST request

put(path, params, callback)Operation

Make a PUT request

patch(path, params, callback)Operation

Make a PATCH request

del(path, params, callback)Operation

Make a DELETE request

parseXML(body, script)Operation

Parse XML with the Cheerio parser

parseCSV(target, config)Operation

CSV-Parse for CSV conversion to JSON

request(params)Operation

Make a request using the 'request' node module. This module is deprecated.

execute(operations) ⇒ Operation

Execute a sequence of operations. Wraps language-common/execute, and prepends initial state for http.

Kind: global function

ParamTypeDescription
operationsOperationsOperations to be performed.

Example

execute(
create('foo'),
delete('bar')
)(state)

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'}
})

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(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'}
})

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'}
})

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'}
})

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);
})

parseCSV(target, config) ⇒ Operation

CSV-Parse for CSV conversion to JSON

Kind: global function
Access: public

ParamTypeDescription
targetStringstring or local file with CSV data
configObjectcsv-parse config object

Example

parseCSV("/home/user/someData.csv", {
quoteChar: '"',
header: false,
});

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);