Skip to content

Locations API

The Locations API manages physical locations, intersections, and geographical zones for traffic monitoring.

Overview

ProcedureTypeAuthDescription
locations.getAllQueryNoGet paginated locations
locations.getByIdQueryNoGet location by ID
locations.createMutationYesCreate new location
locations.updateMutationYesUpdate location
locations.updateSensorsMutationYesUpdate sensors at location
locations.deleteMutationYesDelete location
locations.bulkDeleteMutationYesDelete multiple locations
locations.getTypesQueryNoGet location types

Procedures

locations.getAll

Get a paginated list of locations with filtering and sorting.

Type: Query Auth Required: No

Input

typescript
{
  skip?: number;        // Offset (default: 0)
  take?: number;        // Limit 1-100 (default: 50)
  search?: string;      // Search in name/address
  type?: string;        // Filter by type
  status?: string;      // Filter by status
  sortBy?: "name" | "type" | "status" | "createdAt";
  sortOrder?: "asc" | "desc";
}

Response

typescript
{
  locations: Array<{
    id: string;
    name: string;
    address: string;
    type: string;
    latitude: number;
    longitude: number;
    status: string;
    description: string | null;
    sensorCount: number;
    createdAt: string;
    updatedAt: string;
  }>;
  total: number;
  pageCount: number;
}

Example

bash
curl -X GET "https://api.itms.solutions/trpc/locations.getAll"

locations.getById

Get a single location with its sensors.

Type: Query Auth Required: No

Input

typescript
{
  id: string;
}

Response

typescript
{
  id: string;
  name: string;
  address: string;
  type: string;
  latitude: number;
  longitude: number;
  status: string;
  description: string | null;
  createdAt: string;
  updatedAt: string;
  sensors: Array<{
    id: string;
    name: string;
    deviceId: string;
    type: string;
    status: string;
  }>;
}

locations.create

Create a new location.

Type: Mutation Auth Required: Yes

Input

typescript
{
  name: string;            // 1-100 characters
  address: string;         // 1-255 characters
  type: string;            // e.g., "INTERSECTION", "HIGHWAY"
  latitude: number;        // -90 to 90
  longitude: number;       // -180 to 180
  status?: string;         // Default: "active"
  description?: string;
}

Response

Returns the created location.

Example

bash
curl -X POST "https://api.itms.solutions/trpc/locations.create" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "json": {
      "name": "Main Street Intersection",
      "address": "123 Main St, Almaty",
      "type": "INTERSECTION",
      "latitude": 43.238949,
      "longitude": 76.945465
    }
  }'

locations.update

Update a location and optionally its sensor associations.

Type: Mutation Auth Required: Yes

Input

typescript
{
  id: string;              // Required
  name?: string;
  address?: string;
  type?: string;
  latitude?: number;
  longitude?: number;
  status?: string;
  description?: string;
  sensors?: string[];      // Array of sensor IDs to associate
}

locations.updateSensors

Update which sensors are assigned to a location.

Type: Mutation Auth Required: Yes

Input

typescript
{
  id: string;              // Location ID
  sensors: string[];       // Array of sensor IDs
}

locations.delete

Delete a location. Sensors at this location will be unassigned.

Type: Mutation Auth Required: Yes

Input

typescript
{
  id: string;
}

locations.bulkDelete

Delete multiple locations at once.

Type: Mutation Auth Required: Yes

Input

typescript
{
  ids: string[];
}

Response

typescript
{
  success: number;          // Count of successfully deleted
  failed: number;           // Count of failures
  errors?: Array<{
    id: string;
    error: string;
  }>;
}

locations.getTypes

Get distinct location types with counts.

Type: Query Auth Required: No

Response

typescript
Array<{
  type: string;
  count: number;
}>

Location Types

Common location types used in the system:

TypeDescription
INTERSECTIONTraffic intersection
HIGHWAYHighway or freeway
CHECKPOINTTraffic checkpoint
BRIDGEBridge or overpass
TUNNELTunnel
PARKINGParking area
ZONEGeographical zone

Status Values

StatusDescription
activeLocation is operational
inactiveLocation is not operational
maintenanceLocation under maintenance

SCS Smart City - Traffic, Gateway, Camera, and NVR Platform