AGIN CloudCloud
Operations

Get Farm Operations

Retrieve a list of farm operations including planting, harvesting, and maintenance activities.

GET
/farm-operations
AuthorizationBearer <token>

API key obtained from the AGIN Cloud console

In: header

Query Parameters

farmId?string

Filter operations by farm ID

status?string

Filter by operation status

Value in"PLANNED" | "IN_PROGRESS" | "COMPLETED" | "CANCELLED"
type?string

Filter by operation type

Value in"PLANTING" | "HARVESTING" | "MAINTENANCE" | "IRRIGATION" | "FERTILIZATION" | "PEST_CONTROL"
startDate?string

Filter operations after this date (ISO 8601)

Formatdate
endDate?string

Filter operations before this date (ISO 8601)

Formatdate
limit?integer

Maximum number of operations to return

Default20
Range1 <= value <= 100
offset?integer

Number of operations to skip for pagination

Default0
Range0 <= value

Response Body

curl -X GET "https://agin.cloud/graphql/farm-operations?farmId=farm_abc123&status=IN_PROGRESS&type=HARVESTING&startDate=2024-01-01&endDate=2024-12-31&limit=20&offset=0"

{
  "data": [
    {
      "id": "op_123abc",
      "farmId": "farm_abc123",
      "farmName": "Green Valley Farms",
      "type": "HARVESTING",
      "status": "IN_PROGRESS",
      "cropType": "MAIZE",
      "fieldId": "field_xyz789",
      "fieldName": "North Field",
      "startDate": "2024-10-15",
      "endDate": "2024-10-20",
      "assignedTo": [
        {
          "id": "user_456def",
          "name": "John Doe"
        }
      ],
      "expectedYield": 5000,
      "unit": "KG",
      "notes": "Weather conditions optimal",
      "createdAt": "2024-10-01T08:00:00Z",
      "updatedAt": "2024-10-15T10:30:00Z"
    },
    {
      "id": "op_456def",
      "farmId": "farm_abc123",
      "farmName": "Green Valley Farms",
      "type": "IRRIGATION",
      "status": "COMPLETED",
      "fieldId": "field_xyz789",
      "fieldName": "South Field",
      "startDate": "2024-10-10",
      "endDate": "2024-10-10",
      "assignedTo": [
        {
          "id": "user_789ghi",
          "name": "Jane Smith"
        }
      ],
      "notes": "Drip irrigation completed",
      "createdAt": "2024-10-05T06:00:00Z",
      "updatedAt": "2024-10-10T18:00:00Z"
    }
  ],
  "pagination": {
    "total": 45,
    "limit": 20,
    "offset": 0,
    "hasNext": true
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key",
    "type": "authentication_error"
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key",
    "type": "authentication_error"
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key",
    "type": "authentication_error"
  }
}