{ "info": { "name": "Farm AI Assistant", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "description": "Farm AI Assistant API. Context, chat send, chat list/create, message history, and chat delete." }, "item": [ { "name": "Get farm context (GET)", "request": { "method": "GET", "header": [{"key": "Content-Type", "value": "application/json"}], "url": "{{baseUrl}}/api/farm-ai-assistant/context/", "description": "Returns static farm context for the context bar." }, "response": [ { "name": "Success", "status": "OK", "code": 200, "body": "{\n \"status\": \"success\",\n \"data\": {\n \"soilType\": \"Loamy\",\n \"waterEC\": \"1.2 dS/m\",\n \"selectedCrop\": \"Tomato\",\n \"growthStage\": \"Flowering\",\n \"lastIrrigationStatus\": \"2 days ago\"\n }\n}" } ] }, { "name": "List chats (GET)", "request": { "method": "GET", "header": [{"key": "Content-Type", "value": "application/json"}], "url": "{{baseUrl}}/api/farm-ai-assistant/chats/", "description": "Returns only chat id and message count for the current user." }, "response": [ { "name": "Success", "status": "OK", "code": 200, "body": "{\n \"status\": \"success\",\n \"data\": [\n {\n \"id\": \"conv-123\",\n \"message_count\": 4\n },\n {\n \"id\": \"conv-456\",\n \"message_count\": 2\n }\n ]\n}" } ] }, { "name": "Create chat (POST)", "request": { "method": "POST", "header": [{"key": "Content-Type", "value": "application/json"}], "body": { "mode": "raw", "raw": "{\n \"title\": \"New chat\"\n}" }, "url": "{{baseUrl}}/api/farm-ai-assistant/chats/", "description": "Creates a new empty chat for the current user." }, "response": [ { "name": "Created", "status": "Created", "code": 201, "body": "{\n \"status\": \"success\",\n \"data\": {\n \"id\": \"conv-789\",\n \"message_count\": 0\n }\n}" } ] }, { "name": "Get chat messages (GET)", "request": { "method": "GET", "header": [{"key": "Content-Type", "value": "application/json"}], "url": "{{baseUrl}}/api/farm-ai-assistant/chats/conv-123/messages/", "description": "Returns all user and assistant messages for one chat." }, "response": [ { "name": "Success", "status": "OK", "code": 200, "body": "{\n \"status\": \"success\",\n \"data\": {\n \"conversation_id\": \"conv-123\",\n \"messages\": [\n {\n \"message_id\": \"msg-user-001\",\n \"conversation_id\": \"conv-123\",\n \"role\": \"user\",\n \"content\": \"What is the best irrigation plan for tomato?\",\n \"sections\": [],\n \"images\": [],\n \"created_at\": \"2025-01-01T08:00:00Z\"\n },\n {\n \"message_id\": \"msg-001\",\n \"conversation_id\": \"conv-123\",\n \"role\": \"assistant\",\n \"content\": \"Here is the recommended plan.\",\n \"sections\": [\n {\n \"type\": \"recommendation\",\n \"title\": \"Irrigation Plan\",\n \"icon\": \"droplet\",\n \"frequency\": \"3 times per week\",\n \"amount\": \"15 liters per plant\",\n \"timing\": \"Early morning\",\n \"expandableExplanation\": \"Loamy soil holds moisture well, so moderate frequency is enough.\"\n }\n ],\n \"images\": [],\n \"created_at\": \"2025-01-01T08:00:05Z\"\n }\n ]\n }\n}" } ] }, { "name": "Send chat message (POST)", "request": { "method": "POST", "header": [{"key": "Content-Type", "value": "application/json"}], "body": { "mode": "raw", "raw": "{\n \"conversation_id\": \"conv-123\",\n \"content\": \"What is the best irrigation plan for tomato?\",\n \"farm_context\": {\n \"soilType\": \"Loamy\",\n \"waterEC\": \"1.2 dS/m\",\n \"selectedCrop\": \"Tomato\",\n \"growthStage\": \"Flowering\",\n \"lastIrrigationStatus\": \"2 days ago\"\n }\n}" }, "url": "{{baseUrl}}/api/farm-ai-assistant/chat/", "description": "Sends a user message and returns a structured assistant reply." }, "response": [ { "name": "Success", "status": "OK", "code": 200, "body": "{\n \"status\": \"success\",\n \"data\": {\n \"message_id\": \"msg-001\",\n \"conversation_id\": \"conv-123\",\n \"content\": \"Here is the recommended plan.\",\n \"sections\": [\n {\n \"type\": \"recommendation\",\n \"title\": \"Irrigation Plan\",\n \"icon\": \"droplet\",\n \"frequency\": \"3 times per week\",\n \"amount\": \"15 liters per plant\",\n \"timing\": \"Early morning\",\n \"expandableExplanation\": \"Loamy soil holds moisture well, so moderate frequency is enough.\"\n },\n {\n \"type\": \"list\",\n \"title\": \"Important Notes\",\n \"icon\": \"leaf\",\n \"items\": [\n \"Avoid watering at noon\",\n \"Check leaf stress every two days\"\n ]\n },\n {\n \"type\": \"warning\",\n \"title\": \"Heat Alert\",\n \"icon\": \"warning\",\n \"content\": \"Increase irrigation if temperature rises above 35°C.\"\n }\n ]\n }\n}" } ] }, { "name": "Delete chat (DELETE)", "request": { "method": "DELETE", "header": [{"key": "Content-Type", "value": "application/json"}], "url": "{{baseUrl}}/api/farm-ai-assistant/chats/conv-123/", "description": "Deletes one chat and all messages inside it." }, "response": [ { "name": "Success", "status": "OK", "code": 200, "body": "{\n \"status\": \"success\",\n \"data\": {\n \"conversation_id\": \"conv-123\"\n }\n}" } ] } ], "variable": [{"key": "baseUrl", "value": "http://localhost:8000"}] }