Skip to content

Getting Started

This guide will help you get started with the Smart City TVMS API.

Base URL

All API requests should be made to:

https://api.itms.solutions/trpc

Request Format

The API uses tRPC with superjson transformer. All requests follow the tRPC convention:

Query (GET)

bash
GET /trpc/{procedure}?input={encodedJson}

Mutation (POST)

bash
POST /trpc/{procedure}
Content-Type: application/json

{ "json": { ...data } }

Authentication

Most endpoints require authentication via Bearer token:

bash
curl -X GET "https://api.itms.solutions/trpc/auth.me" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Quick Start

1. Login to get a token

bash
curl -X POST "https://api.itms.solutions/trpc/auth.login" \
  -H "Content-Type: application/json" \
  -d '{"json":{"email":"admin@itms.solutions","password":"Admin@123"}}'

Response:

json
{
  "result": {
    "data": {
      "json": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "user": {
          "id": "admin-001",
          "email": "admin@itms.solutions",
          "firstName": "System",
          "lastName": "Administrator",
          "role": "ADMIN"
        }
      }
    }
  }
}

2. Use the token for authenticated requests

bash
curl -X GET "https://api.itms.solutions/trpc/sensors.getAllSensors" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Error Handling

Errors follow the tRPC error format:

json
{
  "error": {
    "json": {
      "message": "Error message",
      "code": -32001,
      "data": {
        "code": "UNAUTHORIZED",
        "httpStatus": 401
      }
    }
  }
}

Common Error Codes

CodeHTTP StatusDescription
-32001401Unauthorized - Invalid or missing token
-32004404Not Found - Resource doesn't exist
-32600400Bad Request - Invalid input
-32603500Internal Server Error

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