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
}
}"
}'import requests
response = requests.post(
"https://api.meter.com/api/v1/graphql",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"query": """
{
hardwareDevice(serialNumber: "YOUR_SERIAL_NUMBER") {
serialNumber
deviceType
deviceModel
isConnectedToBackend
}
}
"""
},
)
data = response.json()
print(data)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
}
}"
}'import requests
response = requests.post(
"https://api.meter.com/api/v1/graphql",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"query": """
{
networksForCompany(companySlug: "COMPANY_SLUG") {
UUID
label
slug
}
}
"""
},
)
data = response.json()
print(data)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
}
}"
}'import requests
response = requests.post(
"https://api.meter.com/api/v1/graphql",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"query": """
{
virtualDevicesForNetwork(networkUUID: "YOUR_NETWORK_UUID") {
UUID
label
deviceType
deviceModel
isOnline
}
}
"""
},
)
data = response.json()
print(data)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
}
}"
}'import requests
response = requests.post(
"https://api.meter.com/api/v1/graphql",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"query": """
{
networkClients(networkUUID: "YOUR_NETWORK_UUID") {
macAddress
ip
lastSeen
}
}
"""
},
)
data = response.json()
print(data)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
}
}
}
}"
}'import requests
response = requests.post(
"https://api.meter.com/api/v1/graphql",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"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
}
}
}
}
"""
},
)
data = response.json()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