fasthar-api

an API server that returns aggregated data from HTTP Archive (HAR) data from captured network traffic

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

Each fetch becomes a new record in the database and can be looked up later.

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'
curl 'http://localhost:5000/har/history?url=http://thephantomoftheopera.com'
curl 'http://localhost:5000/stats/history?url=http://thephantomoftheopera.com'

Note: the following endpoints can all be filtered by ref.

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