Zonas
Zonas
Nesta página
Nota:
Envie a sua chave com key=A_SUA_CHAVE_API no endereço, ou no cabeçalho X-NWays-Api-Key. Chaves de API
Endereço base: https://nways.ng/maps/v1/fleet
As zonas do projeto (círculos), cada uma com quantos veículos estão nela agora
GET https://nways.ng/maps/v1/fleet/zones
cURL
curl "https://nways.ng/maps/v1/fleet/zones" \
-H "X-NWays-Api-Key: A_SUA_CHAVE_API"JavaScript
const res = await fetch('https://nways.ng/maps/v1/fleet/zones', {
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY },
})
const data = await res.json()Python
import os
import requests
res = requests.get(
"https://nways.ng/maps/v1/fleet/zones",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
timeout=10,
)
data = res.json()Resposta
Zonas
| Campo | Tipo | Descrição |
|---|---|---|
zones | Zone[] | Obrigatório. |
zones[].id | string | Obrigatório. |
zones[].name | string | Obrigatório. |
zones[].lat | number | Obrigatório. |
zones[].lng | number | Obrigatório. |
zones[].radiusM | integer | Obrigatório. |
zones[].vehicles | integer | Obrigatório. Veículos lá dentro agora. |
zones[].createdAt | string (date-time) | Obrigatório. |
zones[].updatedAt | string (date-time) | Obrigatório. |
200 OK
{
"zones": [
{
"id": "string",
"name": "string",
"lat": 0,
"lng": 0,
"radiusM": 0,
"vehicles": 0,
"createdAt": "2026-10-15T09:00:00+01:00",
"updatedAt": "2026-10-15T09:00:00+01:00"
}
]
}Erros
defaultErro
Adicionar uma zona (no máximo 200 por projeto)
POST https://nways.ng/maps/v1/fleet/zones
Os veículos que entram e saem dela enviam zone.entered e zone.exited, a partir da posição mais recente de cada veículo.
Corpo do pedido
| Campo | Tipo | Descrição |
|---|---|---|
id | string | |
name | string | Até 100 caracteres. |
lat | number | Obrigatório. |
lng | number | Obrigatório. |
radiusM | integer | Obrigatório. ≥ 50, ≤ 50000. |
cURL
curl -X POST "https://nways.ng/maps/v1/fleet/zones" \
-H "X-NWays-Api-Key: A_SUA_CHAVE_API" \
-H "Content-Type: application/json" \
-d '{"id":"depot-yaba","name":"Yaba depot","lat":6.5095,"lng":3.3711,"radiusM":300}'JavaScript
const res = await fetch('https://nways.ng/maps/v1/fleet/zones', {
method: 'POST',
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"id": "depot-yaba",
"name": "Yaba depot",
"lat": 6.5095,
"lng": 3.3711,
"radiusM": 300
}),
})
const data = await res.json()Python
import os
import requests
res = requests.post(
"https://nways.ng/maps/v1/fleet/zones",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
json={"id": "depot-yaba", "name": "Yaba depot", "lat": 6.5095, "lng": 3.3711, "radiusM": 300},
timeout=10,
)
data = res.json()Resposta
Criado
| Campo | Tipo | Descrição |
|---|---|---|
id | string | Obrigatório. |
name | string | Obrigatório. |
lat | number | Obrigatório. |
lng | number | Obrigatório. |
radiusM | integer | Obrigatório. |
vehicles | integer | Obrigatório. Veículos lá dentro agora. |
createdAt | string (date-time) | Obrigatório. |
updatedAt | string (date-time) | Obrigatório. |
201 OK
{
"id": "string",
"name": "string",
"lat": 0,
"lng": 0,
"radiusM": 0,
"vehicles": 0,
"createdAt": "2026-10-15T09:00:00+01:00",
"updatedAt": "2026-10-15T09:00:00+01:00"
}Erros
defaultErro
Obter uma zona
GET https://nways.ng/maps/v1/fleet/zones/{id}
Parâmetros
| Nome | Onde | Tipo | Descrição |
|---|---|---|---|
id | caminho | string | Obrigatório. |
cURL
curl "https://nways.ng/maps/v1/fleet/zones/string" \
-H "X-NWays-Api-Key: A_SUA_CHAVE_API"JavaScript
const res = await fetch('https://nways.ng/maps/v1/fleet/zones/string', {
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY },
})
const data = await res.json()Python
import os
import requests
res = requests.get(
"https://nways.ng/maps/v1/fleet/zones/string",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
timeout=10,
)
data = res.json()Resposta
Zona
| Campo | Tipo | Descrição |
|---|---|---|
id | string | Obrigatório. |
name | string | Obrigatório. |
lat | number | Obrigatório. |
lng | number | Obrigatório. |
radiusM | integer | Obrigatório. |
vehicles | integer | Obrigatório. Veículos lá dentro agora. |
createdAt | string (date-time) | Obrigatório. |
updatedAt | string (date-time) | Obrigatório. |
200 OK
{
"id": "string",
"name": "string",
"lat": 0,
"lng": 0,
"radiusM": 0,
"vehicles": 0,
"createdAt": "2026-10-15T09:00:00+01:00",
"updatedAt": "2026-10-15T09:00:00+01:00"
}Erros
defaultErro
Mudar o nome, mover ou redimensionar uma zona (lat e lng em conjunto)
PATCH https://nways.ng/maps/v1/fleet/zones/{id}
Parâmetros
| Nome | Onde | Tipo | Descrição |
|---|---|---|---|
id | caminho | string | Obrigatório. |
Corpo do pedido
| Campo | Tipo | Descrição |
|---|---|---|
name | string | Até 100 caracteres. |
lat | number | |
lng | number | |
radiusM | integer | ≥ 50, ≤ 50000. |
cURL
curl -X PATCH "https://nways.ng/maps/v1/fleet/zones/string" \
-H "X-NWays-Api-Key: A_SUA_CHAVE_API" \
-H "Content-Type: application/json" \
-d '{"name":"string","lat":0,"lng":0,"radiusM":0}'JavaScript
const res = await fetch('https://nways.ng/maps/v1/fleet/zones/string', {
method: 'PATCH',
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"name": "string",
"lat": 0,
"lng": 0,
"radiusM": 0
}),
})
const data = await res.json()Python
import os
import requests
res = requests.patch(
"https://nways.ng/maps/v1/fleet/zones/string",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
json={"name": "string", "lat": 0, "lng": 0, "radiusM": 0},
timeout=10,
)
data = res.json()Resposta
Zona
| Campo | Tipo | Descrição |
|---|---|---|
id | string | Obrigatório. |
name | string | Obrigatório. |
lat | number | Obrigatório. |
lng | number | Obrigatório. |
radiusM | integer | Obrigatório. |
vehicles | integer | Obrigatório. Veículos lá dentro agora. |
createdAt | string (date-time) | Obrigatório. |
updatedAt | string (date-time) | Obrigatório. |
200 OK
{
"id": "string",
"name": "string",
"lat": 0,
"lng": 0,
"radiusM": 0,
"vehicles": 0,
"createdAt": "2026-10-15T09:00:00+01:00",
"updatedAt": "2026-10-15T09:00:00+01:00"
}Erros
defaultErro
Eliminar uma zona
DELETE https://nways.ng/maps/v1/fleet/zones/{id}
Parâmetros
| Nome | Onde | Tipo | Descrição |
|---|---|---|---|
id | caminho | string | Obrigatório. |
cURL
curl -X DELETE "https://nways.ng/maps/v1/fleet/zones/string" \
-H "X-NWays-Api-Key: A_SUA_CHAVE_API"JavaScript
const res = await fetch('https://nways.ng/maps/v1/fleet/zones/string', {
method: 'DELETE',
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY },
})
const data = await res.json()Python
import os
import requests
res = requests.delete(
"https://nways.ng/maps/v1/fleet/zones/string",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
timeout=10,
)
data = res.json()Resposta
Eliminado
Sem conteúdo.
Erros
defaultErro