fasthar-api
v0.0.4
Published
an API server that returns aggregated data from HTTP Archive (HAR) data from captured network traffic
Downloads
12
Readme
fastHAR-api
An API server that returns aggregated data from HTTP Archive (HAR) data from captured network traffic. This is the API for fastHAR.
Dependencies
Install phantomjs on Mac OS X:
brew install phantomjs
Or on Linux:
apt-get install phantomjs
Installation
Install dependencies:
npm install
Set up settings:
cp settings_local.js.dist settings_local.js
Run server:
PORT=5000 node app.js
API usage
Fetch a site to record its network traffic
Each fetch becomes a new record in the database and can be looked up later.
GET
curl 'http://localhost:5000/har/fetch?name=The Phantom of the Opera&url=http://thephantomoftheopera.com'
Or by specifying a ref
identifier (e.g., a SHA or some unique identifier):
curl 'http://localhost:5000/har/fetch?ref=badc0ffee&url=http://thephantomoftheopera.com'
Or even simpler:
curl 'http://localhost:5000/har/fetch?url=http://thephantomoftheopera.com'
POST
curl -X POST 'http://localhost:5000/har/fetch' -d 'name=The Phantom of the Opera&ref=badc0ffee&url=http://thephantomoftheopera.com'
Or even simpler:
curl -X POST 'http://localhost:5000/har/fetch' -d 'url=http://thephantomoftheopera.com'
Return a site's network traffic history
HAR data
curl 'http://localhost:5000/har/history?url=http://thephantomoftheopera.com'
Statistics data (response size, times, totals)
curl 'http://localhost:5000/stats/history?url=http://thephantomoftheopera.com'
Charts data (normalised statistics data)
Note: the following endpoints can all be filtered by ref
.
Filter by response size
curl 'http://localhost:5000/charts/sizes?url=http://thephantomoftheopera.com'
To filter by resource type (e.g., css
):
curl 'http://localhost:5000/charts/sizes?resource=css&url=http://thephantomoftheopera.com'
Filter by response time
curl 'http://localhost:5000/charts/times?url=http://thephantomoftheopera.com'
To filter by resource type (e.g., css
):
curl 'http://localhost:5000/charts/times?resource=css&url=http://thephantomoftheopera.com'
Filter by total counts
curl 'http://localhost:5000/charts/totals?url=http://thephantomoftheopera.com'
To filter by resource type (e.g., css
):
curl 'http://localhost:5000/charts/totals?resource=css&url=http://thephantomoftheopera.com'