API Documentation

A comprehensive guide to using the Retail Store Visit Processor

Overview

This service processes store visit images in bulk, calculating image perimeters and validating store information.

  • Handles multiple concurrent jobs
  • Processes thousands of images per job
  • Validates store information against master data
  • Provides real-time job status updates

Base URL

All URLs referenced in the documentation have the following base:

http://localhost:8081

Submit Job

Create a new job.

Endpoint

POST /api/submit

Request Format

{ "count": 2, "visits": [ { "store_id": "RP00001", "image_url": [ "https://example.com/image1.jpg", "https://example.com/image2.jpg" ], "visit_time": "2024-03-15T10:00:00Z" } ] }

Fields

  • count (required): Number of store visits
  • visits (required): Array of store visits
    • store_id: Valid store ID from Store Master
    • image_url: Array of image URLs
    • visit_time: Visit timestamp (RFC3339 format)

Success Response

Code: 201 CREATED

{ "job_id": 123 }

Error Response

Code: 400 BAD REQUEST

{ "error": "" }

Check Job Status

Get the current status of a processing job.

Endpoint

GET /api/status?jobid={job_id}

Parameters

  • jobid (required): Job ID received from submit endpoint

Success Response

Code: 200 OK

For completed jobs:

{ "status": "completed", "job_id": "" }

For failed jobs:

{ "status": "failed", "job_id": "", "error": [{ "store_id": "RP00001", "error": "" }] }

Error Response

Code: 400 BAD REQUEST

{}

Setup Instructions

Prerequisites

  • Go 1.19 or higher
  • Git

Installation

  1. Clone the repository:
    git clone https://github.com/hitaarthh/store-management-processor
  2. Navigate to project directory:
    cd store-management-processor
  3. Install dependencies:
    go mod download
  4. Run the server:
    go run main.go

Development Environment

  • Operating System: macOS/Linux/Windows
  • Editor: VSCode with Go extension
  • Version Control: Git
  • API Testing: Insomnia/Postman