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
Param | Type | Description |
---|---|---|
operations | Operations | Operations to be performed. |
Example
execute(
create('foo'),
delete('bar')
)(state)
get(path, params, callback) ⇒ Operation
Make a GET request
Kind: global function
Access: public
Param | Type | Description |
---|---|---|
path | string | Path to resource |
params | object | Query, Headers and Authentication parameters |
callback | function | (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
Param | Type | Description |
---|---|---|
path | string | Path to resource |
params | object | Body, Query, Headers and Authentication parameters |
callback | function | (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
Param | Type | Description |
---|---|---|
path | string | Path to resource |
params | object | Body, Query, Headers and Auth parameters |
callback | function | (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
Param | Type | Description |
---|---|---|
path | string | Path to resource |
params | object | Body, Query, Headers and Auth parameters |
callback | function | (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
Param | Type | Description |
---|---|---|
path | string | Path to resource |
params | object | Body, Query, Headers and Auth parameters |
callback | function | (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
Param | Type | Description |
---|---|---|
body | String | data string to be parsed |
script | function | script 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
Param | Type | Description |
---|---|---|
target | String | string or local file with CSV data |
config | Object | csv-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
Param | Type | Description |
---|---|---|
params | object | Query, Headers and Authentication parameters |
Example
request(params);