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
Installation
- Clone the repository:
git clone https://github.com/hitaarthh/store-management-processor
- Navigate to project directory:
cd store-management-processor
- Install dependencies:
go mod download
- 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