Skip to content

API Specification Overview

This page summarizes the backend API surface used by the Gezen mobile app.

Runtime Configuration

The app reads backend URLs from .env through app.config.ts and app/config/runtimeConfig.ts. Axios uses them in app/services/apiClient.ts.

Variable Used for Example
EXPO_PUBLIC_API_URL Main backend http://192.168.10.135:8000/api
EXPO_PUBLIC_TASK_PHOTO_API_URL Legacy task-photo backend http://192.168.10.135:8000/api/v1

Rules:

  • Use full URLs including the path suffix. The app calls relative paths such as /auth/token against EXPO_PUBLIC_API_URL.
  • Do not configure backend URLs in app/constants.ts; that file is legacy and unused for API calls.
  • After changing .env, stop Metro and restart with npx expo start -c.
  • Production sample values used in tests include https://sales.iqvizyon.com/api and https://api.iqv.com.tr/api/v1, but your environment values come from your own .env.

Setup details: setup.md

Authentication

All protected requests use a Bearer token from expo-secure-store:

Authorization: Bearer <token>

Auth endpoints

  • POST /auth/token
  • Form-encoded username/password login
  • GET /users/me
  • Returns the current authenticated user

Auth tokens are stored under user_token.

Main Resource Groups

Factories

  • GET /factories
  • POST /factories
  • PUT /factories/{factoryId}

The current frontend derives a single factory detail from the list response when needed instead of relying on a dedicated detail endpoint.

Machines

  • GET /machines
  • GET /machines/{machineId}
  • POST /machines
  • PUT /machines/{machineId}
  • DELETE /machines/{machineId}
  • GET /machines/{machineId}/images/
  • POST /machines/{machineId}/images/
  • DELETE /machines/{machineId}/images/{imageId}

Machine image URLs are also composed on the client from the main backend host and the legacy /uploads/machine_images/{machineId}/{fileName} path.

Machine Reference Data

  • GET /machine-brands
  • POST /machine-brands
  • GET /machine-models
  • POST /machine-models
  • GET /machine-types
  • POST /machine-types
  • PUT /machine-types/{id}
  • DELETE /machine-types/{id}
  • GET /control-panel-brands
  • POST /control-panel-brands
  • GET /control-panel-models
  • POST /control-panel-models

Tasks

  • GET /tasks
  • GET /tasks/{taskId}
  • POST /tasks
  • PUT /tasks/{taskId}
  • DELETE /tasks/{taskId}
  • PUT /tasks/{taskId}/status
  • POST /tasks/{taskId}/notes

Quotes

  • GET /devices
  • GET /quotes
  • GET /quotes/{quoteId}
  • POST /quotes
  • PUT /quotes/{quoteId}
  • GET /quotes/{quoteId}/proforma/
  • POST /quotes/{quoteId}/send-proforma/
  • GET /quote-items
  • GET /quote-items/{id}
  • POST /quote-items
  • PUT /quote-items/{id}
  • DELETE /quote-items/{id}
  • POST /quotes/{quoteId}/create-followup-event

Calendar

  • GET /calendar-events
  • GET /calendar-events/{eventId}
  • POST /calendar-events
  • PUT /calendar-events/{eventId}
  • DELETE /calendar-events/{eventId}

Notifications

  • GET /notifications
  • GET /notifications/unread-count
  • PUT /notifications/{notificationId}/read
  • PUT /notifications/mark-all-read
  • POST /user/push-token

Production Catalog

  • GET /sectors
  • POST /sectors
  • GET /production-categories
  • POST /production-categories
  • GET /production-areas
  • POST /production-areas
  • GET /production-modules
  • POST /production-sub-modules

Users

  • GET /users

ROI and Solution Center

  • POST /simple-roi-analysis/{factoryId}
  • Uses a longer client timeout
  • POST /solution-center

Legacy Task-Photo Backend

Task photo operations are handled through a separate client and base URL:

  • POST /tasks/{taskId}/photos
  • DELETE /tasks/{taskId}/photos/{photoId}

This backend is intentionally isolated in app/services/taskPhotoService.ts.

Frontend Compatibility Wrappers

The codebase still contains a few thin compatibility layers:

  • app/services/calendarEventApi.ts wraps the canonical calendar client
  • app/services/mobileApi.ts exposes older list helpers for machines and factories
  • app/services/machineApi.ts exposes a small mobile machine helper used by older screens

The canonical API modules now live under app/services/api/*.