Asset Workflow
Set up pump stations, application zones, and devices the same way the Vital app does.
The Assets screen has three lists: pump stations, application zones, and devices. A device posts through one active location, and that location belongs to one application zone.
Organization
├── Pump station
├── Application zone
└── Device
└── Location (one zone while the device is active)Pump stations and application zones both belong to the organization. Link a zone to a pump station when that station supplies it. Write calls require an admin, manager, or vital_admin role in the organization.
1. Create a pump station
POST /create_pump_station
Send a client-generated id, a name, the organization, and a GeoJSON point. Longitude comes first. user_id is the irrigator and can be omitted.
{
"id": "a4677a4c-a8c6-475a-8f42-09c1c113be1f",
"name": "North station",
"organization_id": 1,
"location": {
"type": "Feature",
"properties": {},
"geometry": { "type": "Point", "coordinates": [-120.53, 46.6] }
},
"user_id": 12
}List stations with GET /pump_stations?organization_id=1.
2. Create an application zone
POST /create_application_zone
Draw the boundary, then send a client-generated id, a name, the organization, the boundary, the crop, and the application rate in mm/hr. variety_id is optional. The active name must be unique in the organization. A boundary that matches another active zone returns 409.
{
"id": "0de4b98d-0716-4bb4-a2c6-44ec4a237dc7",
"name": "Block 4",
"organization_id": 1,
"crop_id": 3,
"variety_id": 12,
"irrigation_type": "drip",
"application_rate_mm_per_hr": 1.23,
"geometries": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-120.5315, 46.6021],
[-120.53, 46.6021],
[-120.53, 46.6035],
[-120.5315, 46.6035],
[-120.5315, 46.6021]
]
]
]
}
}List zones with GET /application_zones. Pass organization_id to match the Assets screen.
Active devices whose coordinates already fall inside the new boundary can be assigned in the same step. Use the location update below for each one.
Link the zone to a pump station:
PATCH /application_zones/{zone_id}/pump_station
{ "pump_station_id": "a4677a4c-a8c6-475a-8f42-09c1c113be1f" }3. Activate a device
POST /activate-device/?product_id=100&serial_number=123456&device_model=basic
Activation creates the device when the serial is new, opens a location, and starts an assignment. An already-active device is rejected until it is deactivated. See Device Lifecycle.
4. Assign the location to a zone
PUT /locations/{location_id}/?organization_id=1
{ "application_zone_id": "0de4b98d-0716-4bb4-a2c6-44ec4a237dc7" }This is the first assignment for that location. Once set, it stays. The map offers this when an unassigned device sits inside a zone. To move a device, deactivate it, activate it again, and assign the new location.
List locations and devices with GET /locations and GET /devices.
5. Deactivate a device
POST /deactivate-device/?product_id=100&serial_number=123456
Deactivation archives the location, closes the assignment, and marks the device dormant. The same serial can be activated again later.
Retire a zone
Deactivate every device assigned to the zone, then:
PATCH /application_zones/{zone_id}/update_status
{ "status": "archived" }Archived zones drop out of the default list. This call is limited to admin and vital_admin. A zone that still has an active location cannot be archived.
