Skip to main content
GET
/
api
/
recommendations
/
:id
Get Recommendation
curl --request GET \
  --url https://api.example.com/api/recommendations/:id
{
  "success": true,
  "data": {
    "recommendation_id": 123,
    "user_id": 123,
    "user_name": "<string>",
    "email": "<string>",
    "terrain_name": "<string>",
    "soil_type": "<string>",
    "slope_percentage": 123,
    "tractor_name": "<string>",
    "tractor_brand": "<string>",
    "tractor_model": "<string>",
    "engine_power_hp": 123,
    "implement_name": "<string>",
    "implement_type": "<string>",
    "power_requirement_hp": 123,
    "compatibility_score": 123,
    "observations": "<string>",
    "work_type": "<string>",
    "recommendation_date": "<string>"
  }
}

Overview

Retrieves complete details of a specific recommendation including user, terrain, tractor, implement data, compatibility score, and detailed observations.
Users can only access their own recommendations.

Authentication

Required: Bearer token in Authorization header
Authorization: Bearer <your_jwt_token>

Path Parameters

id
integer
required
The unique identifier of the recommendation

Response

success
boolean
Indicates if the request was successful
data
object
Complete recommendation details

Examples

curl -X GET "http://localhost:4000/api/recommendations/15" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json"

Response Example (200 OK)

{
  "success": true,
  "data": {
    "recommendation_id": 15,
    "user_id": 3,
    "user_name": "Juan Pérez",
    "email": "[email protected]",
    "terrain_name": "Highland Farm North",
    "soil_type": "Clay",
    "slope_percentage": 18.5,
    "tractor_name": "New Holland T6.175",
    "tractor_brand": "New Holland",
    "tractor_model": "T6.175",
    "engine_power_hp": 175,
    "implement_name": "3-body disc plow",
    "implement_type": "plow",
    "power_requirement_hp": 120,
    "compatibility_score": 87.5,
    "observations": "{\"rank\":1,\"scores\":{\"efficiency\":28,\"traction\":25,\"soil\":18,\"economic\":10,\"availability\":10},\"explanation\":\"Optimal match for steep terrain with clay soil. 4x4 traction provides safety. Power utilization at 89.5%\"}",
    "work_type": "tillage",
    "recommendation_date": "2026-03-10T15:30:00.000Z"
  }
}

Error Responses

Status CodeDescription
401Missing or invalid authentication token
404Recommendation not found or doesn’t belong to user
500Internal server error

Observations Field

The observations field contains a JSON string with detailed scoring information:
{
  "rank": 1,
  "scores": {
    "efficiency": 28,
    "traction": 25,
    "soil": 18,
    "economic": 10,
    "availability": 10
  },
  "explanation": "Detailed reasoning for the recommendation"
}

Generate Recommendation

Generate new tractor recommendations

Recommendation History

View all recommendations

Source Code Reference

  • Route: src/routes/recommendation.routes.js:312
  • Controller: src/controllers/recommendationController.js:getRecommendationById

Build docs developers (and LLMs) love