Get a list of sites

GET /api/v1/sites

Retrieve all sites associated with the authenticated API token. If the API token is scoped to one site, only that site will be returned. If the API token is scoped to the entire account, all sites under that account will be returned.

Query parameters

  • per_page integer

    Number of items per page.

  • fields string(csv)

    Comma-separated list of fields to be returned in the response. Only 'id', 'name', 'web', 'address', 'country', 'province', and 'created_at' columns are allowed.

  • filter object

    Filter criteria to narrow down the list of sites. The filter parameter is an object with key-value pairs where the key is the field to filter by and the value is '{operator}{value}'. The operator is optional and defaults to '='. (e.g. '/sites?filter[id]=>100&filter[created_at]=>2021-01-01')

    Hide filter attributes Show filter attributes object
    • created_at string

      Filter by date with operators '>', '<', '>=', or '<='.

    • id string

      Filter by ID with operators '>', '<', '>=', or '<='.

    • name string

      Filter by name with partial matching.

    • address string

      Filter by address with partial matching.

    • country string

      Filter by country with partial matching.

    • province string

      Filter by province with partial matching.

  • sort string

    Field to sort the results by. Only 'id' and 'created_at' columns are allowed, prefixed with a minus sign (-) for descending order and without for ascending order.

    Values are id, -id, created_at, or -created_at.

Responses

  • 200 application/json

    Successful operation

    Hide response attributes Show response attributes object
    • data array[object]
      Hide data attributes Show data attributes object
      • id integer
      • name string

        Name of the site

      • web string

        URL of the site's website

      • address string

        Street address of the site

      • country string

        Country where the site is located

      • province string

        State or province where the site is located

      • created_at string(date-time)

        Date and time the site was created (UTC time)

    • metadata object
      Hide metadata attributes Show metadata attributes object
      • current_page integer
      • last_page integer
      • per_page integer
      • total integer
      • next_page_url string
      • prev_page_url string
  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
    • error string
    • message string
    • error_code number
  • 403 application/json

    Forbidden

    Hide response attributes Show response attributes object
    • error string
    • message string
    • error_code number
  • 422 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • error string
    • message string
    • error_code number
GET /api/v1/sites
curl \
 --request GET 'https://publicapi.ekareinc.com/api/v1/sites' \
 --header "X-API-KEY: $API_KEY"
Response examples (200)
{
  "data": [
    {
      "id": 1168,
      "name": "eKare HQ",
      "web": "https://ekareinc.com",
      "address": "123 Main St",
      "country": "US",
      "province": "DC",
      "created_at": "2021-01-01 00:00:00"
    }
  ],
  "metadata": {
    "current_page": 1,
    "last_page": 10,
    "per_page": 2,
    "total": 20,
    "next_page_url": "https://publicapi.ekareinc.com/api/v1/sites?page=2",
    "prev_page_url": "string"
  }
}
Response examples (401)
{
  "error": "Invalid API token",
  "message": "Unauthorized. Please provide a valid API token.",
  "error_code": "100"
}
Response examples (403)
{
  "error": "Access denied",
  "message": "Forbidden. You do not have permission to access this resource.",
  "error_code": "101"
}
Response examples (422)
{
  "error": "Bad Request",
  "message": "The given data was invalid.",
  "error_code": "102"
}