Examples

Overview

The examples below show how to query the Meter API using curl and Python with the requests library. You can use any HTTP client that supports POST requests with JSON bodies.

In each example, replace YOUR_API_KEY with your API key and substitute the appropriate UUIDs for your network.

Look up a hardware device

Retrieve a hardware device by its serial number.

curl -X POST https://api.meter.com/api/v1/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "{
      hardwareDevice(serialNumber: \"YOUR_SERIAL_NUMBER\") {
        serialNumber
        deviceType
        deviceModel
        isConnectedToBackend
      }
    }"
  }'

List all networks

Retrieve all networks for the given company.

curl -X POST https://api.meter.com/api/v1/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "{
      networksForCompany(companySlug: \"COMPANY_SLUG\") {
        UUID
        label
        slug
      }
    }"
  }'

List devices on a network

Retrieve all virtual devices for a given network.

curl -X POST https://api.meter.com/api/v1/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "{
      virtualDevicesForNetwork(networkUUID: \"YOUR_NETWORK_UUID\") {
        UUID
        label
        deviceType
        deviceModel
        isOnline
      }
    }"
  }'

Get connected clients

Retrieve the clients currently connected to a network.

curl -X POST https://api.meter.com/api/v1/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "{
      networkClients(networkUUID: \"YOUR_NETWORK_UUID\") {
        macAddress
        ip
        lastSeen
      }
    }"
  }'

Full network overview

Retrieve a company and all of its networks in a single query, including each network's devices, VLANs, and SSIDs.

curl -X POST https://api.meter.com/api/v1/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "{
      companyBySlug(slug: \"COMPANY_SLUG\") {
        name
        networks {
          UUID
          label
          isActive
          mailingAddress {
            city
            subdivisionCode
          }
          virtualDevices {
            label
            deviceType
            hardwareDevice {
              serialNumber
              isConnectedToBackend
            }
          }
          vlans {
            name
            vlanID
            isEnabled
          }
          ssids {
            ssid
            isEnabled
          }
        }
      }
    }"
  }'

Need help?

If you run into any issues or have questions, please reach out to our Support Engineering team by opening a ticket via the Dashboard: https://dashboard.meter.com/support

Was this helpful?