RESTful API Interface

Spider provides RESTful API interface for some common tasks since v2.6.0 release.

  • The base URL of API endpoints is https://<server>/api.

    • If you don't have ssl cert, the base URL should be http://<server>:8080/api.
    • Replace <server> by your real server hostname or IP address.
  • An API token is required for all API requests.

    • Please follow our tutorial API Tokens to either generate a new one, or use an existing one.
    • Please submit API token in HTTP header X-Spider-API-Token: (case sensitive).
    • Replace <api-token> by a real one in our sample commands below.
    • Sample http POST request with command curl to submit API token:
      curl \
          -X POST \
          -H "X-Spider-API-Token: <api-token>" \
          ...
      
  • The API interface returns data in JSON format.

    • It always returns http status code 200. If some error happens, the detailed error message will be wrote as value of _msg key of returned JSON string.
    • For example:
    {
        "_success": true,
        "_msg": "...",
        "data": ...
    }
    
  • Data submitted to API interface (via http method POST, PUT) must be in JSON format too.

Sample API requests

  • Get statstics of domain example.com in 2023:
curl \
    -X GET \
    -H "X-Spider-API-Token: <api-token>" \
    https://<server>/api/archiving_stats?domain=example.com&year=2023

API Endpoints

Detailed parameters and response data can be checked on your running Spider server by visiting URL: https://<server>/doc/api/.

  • GET /archiving_stats/global. Get global (server-wide, accumulated) archiving statistics. (v2.6.0)
  • GET /archiving_stats. Get per-domain or per-mailbox archiving statistics. (v2.6.0)