@datafire/rbaskets_in v6.0.0
@datafire/rbaskets_in
Client library for Request Baskets API
Installation and Usage
npm install --save @datafire/rbaskets_in
let rbaskets_in = require('@datafire/rbaskets_in').create({
basket_token: "",
service_token: ""
});
.then(data => {
console.log(data);
});
Description
RESTful API of Request Baskets service.
Request Baskets is an open source project of a service to collect HTTP requests and inspect them via RESTful API or web UI.
Check out the project page for more detailed description.
Actions
api.baskets.get
Fetches a list of basket names managed by service. Require master token.
rbaskets_in.api.baskets.get({}, context)
Input
- input
object
- max
integer
: Maximum number of basket names to return; default 20 - skip
integer
: Number of basket names to skip; default 0 - q
string
: Query string to filter result, only those basket names that match the query will be included in response
- max
Output
- output Baskets
api.baskets.name.delete
Permanently deletes this basket and all collected requests.
rbaskets_in.api.baskets.name.delete({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name
- name required
Output
Output schema unknown
api.baskets.name.get
Retrieves configuration settings of this basket.
rbaskets_in.api.baskets.name.get({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name
- name required
Output
- output Config
api.baskets.name.post
Creates a new basket with this name.
rbaskets_in.api.baskets.name.post({
"name": ""
}, context)
Input
- input
object
- name required
string
: The name of new basket - config Config
- name required
Output
- output Token
api.baskets.name.put
Updates configuration settings of this basket.
Special configuration parameters for request forwarding:
insecure_tls
controls certificate verification when forwarding requests. Setting this parameter totrue
allows to forward collected HTTP requests via HTTPS protocol even if the forward end-point is configured with self-signed TLS/SSL certificate. Warning: enabling this feature has known security implications.expand_path
changes the logic of constructing taget URL when forwarding requests. If this parameter is set totrue
the forward URL path will be expanded when original HTTP request contains compound path. For example, a basket with name server1 is configured to forward all requests tohttp://server1.intranet:8001/myservice
and it has received an HTTP request likeGET http://baskets.example.com/server1/component/123/events?status=OK
then depending onexpand_path
settings the request will be forwarded to:true
=>GET http://server1.intranet:8001/myservice/component/123/events?status=OK
false
=>GET http://server1.intranet:8001/myservice?status=OK
rbaskets_in.api.baskets.name.put({
"name": "",
"config": {}
}, context)
Input
- input
object
- name required
string
: The basket name - config required Config
- name required
Output
Output schema unknown
api.baskets.name.requests.delete
Deletes all requests collected by this basket.
rbaskets_in.api.baskets.name.requests.delete({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name
- name required
Output
Output schema unknown
api.baskets.name.requests.get
Fetches collection of requests collected by this basket.
rbaskets_in.api.baskets.name.requests.get({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name - max
integer
: Maximum number of requests to return; default 20 - skip
integer
: Number of requests to skip; default 0 - q
string
: Query string to filter result, only requests that match the query will be included in response - in
string
(values: any, body, query, headers): Defines what is taken into account when filtering is applied:body
- search in content body of collected requests,
- name required
Output
- output Requests
api.baskets.name.responses.method.get
Retrieves information about configured response of the basket. Service will reply with this response to any HTTP request sent to the basket with appropriate HTTP method.
If nothing is configured, the default response is HTTP 200 - OK with empty content.
rbaskets_in.api.baskets.name.responses.method.get({
"name": "",
"method": ""
}, context)
Input
- input
object
- name required
string
: The basket name - method required
string
(values: GET, HEAD, POST, PUT, PATCH, DELETE, CONNECT, OPTIONS, TRACE): The HTTP method this response is configured for
- name required
Output
- output Response
api.baskets.name.responses.method.put
Allows to configure HTTP response of this basket. The service will reply with configured response to any HTTP request sent to the basket with appropriate HTTP method.
If nothing is configured, the default response is HTTP 200 - OK with empty content.
rbaskets_in.api.baskets.name.responses.method.put({
"name": "",
"method": "",
"response": {}
}, context)
Input
- input
object
- name required
string
: The basket name - method required
string
(values: GET, HEAD, POST, PUT, PATCH, DELETE, CONNECT, OPTIONS, TRACE): The HTTP method this response is configured for - response required Response
- name required
Output
Output schema unknown
api.stats.get
Get service statistics about baskets and collected HTTP requests. Require master token.
rbaskets_in.api.stats.get({}, context)
Input
- input
object
- max
integer
: Maximum number of basket names to return; default 5
- max
Output
- output ServiceStats
api.version.get
Get service version.
rbaskets_in.api.version.get(null, context)
Input
This action has no parameters
Output
- output Version
baskets.get
Fetches a list of basket names managed by service. Require master token.
rbaskets_in.baskets.get({}, context)
Input
- input
object
- max
integer
: Maximum number of basket names to return; default 20 - skip
integer
: Number of basket names to skip; default 0 - q
string
: Query string to filter result, only those basket names that match the query will be included in response
- max
Output
- output Baskets
baskets.name.delete
Permanently deletes this basket and all collected requests.
rbaskets_in.baskets.name.delete({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name
- name required
Output
Output schema unknown
baskets.name.get
Retrieves configuration settings of this basket.
rbaskets_in.baskets.name.get({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name
- name required
Output
- output Config
baskets.name.post
Creates a new basket with this name.
rbaskets_in.baskets.name.post({
"name": ""
}, context)
Input
- input
object
- name required
string
: The name of new basket - config Config
- name required
Output
- output Token
baskets.name.put
Updates configuration settings of this basket.
Special configuration parameters for request forwarding:
insecure_tls
controls certificate verification when forwarding requests. Setting this parameter totrue
allows to forward collected HTTP requests via HTTPS protocol even if the forward end-point is configured with self-signed TLS/SSL certificate. Warning: enabling this feature has known security implications.expand_path
changes the logic of constructing taget URL when forwarding requests. If this parameter is set totrue
the forward URL path will be expanded when original HTTP request contains compound path. For example, a basket with name server1 is configured to forward all requests tohttp://server1.intranet:8001/myservice
and it has received an HTTP request likeGET http://baskets.example.com/server1/component/123/events?status=OK
then depending onexpand_path
settings the request will be forwarded to:true
=>GET http://server1.intranet:8001/myservice/component/123/events?status=OK
false
=>GET http://server1.intranet:8001/myservice?status=OK
rbaskets_in.baskets.name.put({
"name": "",
"config": {}
}, context)
Input
- input
object
- name required
string
: The basket name - config required Config
- name required
Output
Output schema unknown
baskets.name.requests.delete
Deletes all requests collected by this basket.
rbaskets_in.baskets.name.requests.delete({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name
- name required
Output
Output schema unknown
baskets.name.requests.get
Fetches collection of requests collected by this basket.
rbaskets_in.baskets.name.requests.get({
"name": ""
}, context)
Input
- input
object
- name required
string
: The basket name - max
integer
: Maximum number of requests to return; default 20 - skip
integer
: Number of requests to skip; default 0 - q
string
: Query string to filter result, only requests that match the query will be included in response - in
string
(values: any, body, query, headers): Defines what is taken into account when filtering is applied:body
- search in content body of collected requests,
- name required
Output
- output Requests
baskets.name.responses.method.get
Retrieves information about configured response of the basket. Service will reply with this response to any HTTP request sent to the basket with appropriate HTTP method.
If nothing is configured, the default response is HTTP 200 - OK with empty content.
rbaskets_in.baskets.name.responses.method.get({
"name": "",
"method": ""
}, context)
Input
- input
object
- name required
string
: The basket name - method required
string
(values: GET, HEAD, POST, PUT, PATCH, DELETE, CONNECT, OPTIONS, TRACE): The HTTP method this response is configured for
- name required
Output
- output Response
baskets.name.responses.method.put
Allows to configure HTTP response of this basket. The service will reply with configured response to any HTTP request sent to the basket with appropriate HTTP method.
If nothing is configured, the default response is HTTP 200 - OK with empty content.
rbaskets_in.baskets.name.responses.method.put({
"name": "",
"method": "",
"response": {}
}, context)
Input
- input
object
- name required
string
: The basket name - method required
string
(values: GET, HEAD, POST, PUT, PATCH, DELETE, CONNECT, OPTIONS, TRACE): The HTTP method this response is configured for - response required Response
- name required
Output
Output schema unknown
Definitions
BasketInfo
- BasketInfo
object
- last_request_date
integer
: Date and time of last request processed through this basket in Unix time ms. - name
string
: Basket name - requests_count
integer
: Current number of collected HTTP requests held by basket - requests_total_count
integer
: Total number of all HTTP requests passed through this basket
- last_request_date
Baskets
- Baskets
object
- count
integer
: Total number of baskets in the system; not present if query is applied - has_more required
boolean
: Indicates if there are more baskets to fetch - names required
array
: Collection of basket names- items
string
- items
- count
Config
- Config
object
- capacity
integer
: Baskets capacity, defines maximum number of requests to store - expand_path
boolean
: If set totrue
the forward URL path will be expanded when original HTTP request contains compound path. - forward_url
string
: URL to forward all incoming requests of the basket,empty
value disables forwarding - insecure_tls
boolean
: If set totrue
the certificate verification will be disabled if forward URL indicates HTTPS scheme. - proxy_response
boolean
: If set totrue
this basket behaves as a full proxy: responses from underlying service configured inforward_url
- capacity
Headers
- Headers
object
: Map of HTTP headers, key represents name, value is array of values
Request
- Request
object
- body
string
: Content of request body - content_length
integer
: Content length of request - date
integer
: Date and time of request in Unix time ms. format (number of milliseconds elapsed since January 1, 1970 UTC) - headers Headers
- method
string
: HTTP method of request - path
string
: URL path of request - query
string
: Query parameters of request
- body
Requests
- Requests
object
- count
integer
: Current number of collected requests hold by basket; not present if query is applied - has_more required
boolean
: Indicates if there are more requests collected by basket to fetch - requests required
array
: Collection of collected requests- items Request
- total_count
integer
: Total number of all requests passed through this basket; not present if query is applied
- count
Response
- Response
object
- body
string
: Content of response body - headers Headers
- is_template
boolean
: If set totrue
the body is treated as HTML template that accepts - status
integer
: The HTTP status code to reply with
- body
ServiceStats
- ServiceStats
object
- avg_basket_size
integer
: Average size of a basket in the system, empty baskets are not taken into account - baskets_count
integer
: Total number of baskets managed by service - empty_baskets_count
integer
: Number of empty baskets - max_basket_size
integer
: Size of the biggest basket that processed the top most number of HTTP requests - requests_count
integer
: Number of HTTP requests currently stored by service - requests_total_count
integer
: Total number of HTTP requests processed by service - top_baskets_recent
array
: Collection of top baskets recently active- items BasketInfo
- top_baskets_size
array
: Collection of top basket by size- items BasketInfo
- avg_basket_size
Token
- Token
object
- token required
string
: Secure token to manage the basket, generated by system
- token required
Version
- Version
object
- commit
string
: Git commit this service is build from - commit_short
string
: Short form of git commit this service is build from - name
string
: Service name - source_code
string
: URL of the source code repository - version
string
: Service version
- commit