API Access to Webscript Request Logs

Earlier this week, we launched a beta of the Webscript API. As mentioned in that post, a few customers have asked to access their request logs via an API, so today we added that functionality.

Below is a simple curl example that fetches the logs for a script. The API returns the 20 most recent log entries in reverse chronological order. For the full API details, read the Webscript API documentation.

$ curl https://www.webscript.io/api/0.1/log/example/hello -u [email protected]:b889a1c92c3a41758bcedc73b7355e49
[
 {
   "timestamp": "2012-12-05T16:42:27.656081+00:00",
   "request": {
     "url": "examples.webscript.io/hello",
     "headers": {
       "X-Forwarded-Port": "80",
       "X-Forwarded-For": "71.197.165.147",
       "Connection": "close",
       "Accept": "*/*",
       "User-Agent": "curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5",
       "Host": "examples.webscript.io",
       "X-Forwarded-Proto": "http"
     },
     "method": "GET"
   },
   "messages": ["This is a log message."],
   "response": {
     "body": "Hello, World!",
     "status_code": 200,
     "headers": {
       "Content-Length": 13,
       "Content-Type": "text/plain",
       "Access-Control-Allow-Origin": "*",
       "Cache-Control": "no-store"
     }
   }
 },
 ...
]