Search code examples
statapiaxle

ApiAxle: cannot access stat URL in order to view analytics


I am following the instructions at: http://apiaxle.com/docs/statistics-and-analytics-in-apiaxle/ . Unfortunately currently (May 17, 2014) apiAxle is redirecting me to the endPointserver and I am not getting statist

menelaos:~$ curl 'http://localhost:3000/v/api/test/stats?
granularity=hour&format_timestamp=ISO'

Response:

{"meta":{"version":1,"status_code":404},"results":{"error":
{"type":"ApiUnknown","message":"No api specified (via subdomain)"}}}

I also tried using the subdomain but that didn't work either:

menelaos:~$ curl 'http://test.api.localhost:3000/v/api/test/stats?granularity=hour&format_timestamp=ISO'

Solution

  • Typically you run multiple instances of apiaxle-proxy (which provides access to your endpoints), and a single instances of apiaxle-api (which provides access to statistics, key creation, and other API management functionality).

    For example, you might be running the proxy like this:

    apiaxle-proxy -f 1 -p 3000 -q

    To run the API, you would run something like this:

    apiaxle-api -f 1 -p 5000 -q

    Note that the API needs to run on a separate port. Also note that it shouldn't be accessible to the outside world as it doesn't have any authentication.

    Using the above example, your curl command would look like this:

    curl -H 'content-type: application/json' \
    -X GET \
    'http://localhost:5000/v1/api/test/stats' \
    -d '{"granularity":"hour","format_timestamp":"ISO"}'
    

    Note that the parameters need to be sent as JSON.