Farms API

This section contains all the endpoints related to farm management, including farm listings, details, and creation.

POST /v1/farms/{id}/crops
Rate Limit: 500/min Cost: ₦0.0050

Add Farm Crop

Add a crop to a farm.

Example API Call

curl -X POST "https://api.riwe.io/v1/farms/{id}/crops" \
  -H "X-API-KEY: your_api_key_here"
POST /v1/farms
Rate Limit: 500/min Cost: ₦0.0100

Create Farm

Create a new farm.

Example API Call

curl -X POST "https://api.riwe.io/v1/farms" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "id": 3,
    "name": "New Farm",
    "size": 18.3,
    "status": "active",
    "location": "Kano, Nigeria",
    "soil_type": "Sandy loam",
    "created_at": "2023-08-01T12:30:45Z",
    "updated_at": "2023-08-01T12:30:45Z",
    "coordinates": {
        "latitude": 12.0022,
        "longitude": 8.592
    },
    "description": "My new farm in Kano"
}
DELETE /v1/farms/{id}
Rate Limit: 500/min Cost: ₦0.0050

Delete Farm

Delete a farm.

Example API Call

curl -X DELETE "https://api.riwe.io/v1/farms/{id}" \
  -H "X-API-KEY: your_api_key_here"
GET /v1/farms/{id}
Rate Limit: 1000/min Cost: ₦0.0020

Get Farm

Get details of a specific farm.

Example API Call

curl -X GET "https://api.riwe.io/v1/farms/{id}" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "id": 1,
    "name": "Main Farm",
    "size": 25.5,
    "crops": [
        {
            "id": 1,
            "area": 15,
            "name": "Maize",
            "status": "growing",
            "variety": "TZPB-SR",
            "planting_date": "2023-03-15",
            "expected_harvest_date": "2023-06-15"
        },
        {
            "id": 2,
            "area": 10.5,
            "name": "Cassava",
            "status": "growing",
            "variety": "TME 419",
            "planting_date": "2023-04-01",
            "expected_harvest_date": "2024-01-01"
        }
    ],
    "status": "active",
    "location": "Lagos, Nigeria",
    "soil_type": "Loamy",
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-04-15T09:45:00Z",
    "coordinates": {
        "latitude": 6.5244,
        "longitude": 3.3792
    },
    "description": "Primary farming location with diverse crops",
    "boundary_coordinates": [
        [
            6.524,
            3.379
        ],
        [
            6.5245,
            3.379
        ],
        [
            6.5245,
            3.3795
        ],
        [
            6.524,
            3.3795
        ],
        [
            6.524,
            3.379
        ]
    ]
}
GET /v1/farms/{id}/crops
Rate Limit: 1000/min Cost: ₦0.0020

Get Farm Crops

Get the crops for a specific farm.

Example API Call

curl -X GET "https://api.riwe.io/v1/farms/{id}/crops" \
  -H "X-API-KEY: your_api_key_here"
GET /v1/farms
Rate Limit: 1000/min Cost: ₦0.0020

List Farms

Get a list of farms.

Example API Call

curl -X GET "https://api.riwe.io/v1/farms" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "data": [
        {
            "id": 1,
            "name": "Main Farm",
            "size": 25.5,
            "crops": [
                "Maize",
                "Cassava"
            ],
            "status": "active",
            "location": "Lagos, Nigeria",
            "created_at": "2023-01-01T00:00:00Z",
            "updated_at": "2023-01-01T00:00:00Z",
            "coordinates": {
                "latitude": 6.5244,
                "longitude": 3.3792
            }
        },
        {
            "id": 2,
            "name": "Secondary Farm",
            "size": 15.2,
            "crops": [
                "Rice",
                "Beans"
            ],
            "status": "active",
            "location": "Abuja, Nigeria",
            "created_at": "2023-02-01T00:00:00Z",
            "updated_at": "2023-02-01T00:00:00Z",
            "coordinates": {
                "latitude": 9.0765,
                "longitude": 7.3986
            }
        }
    ],
    "meta": {
        "total": 2,
        "per_page": 20,
        "last_page": 1,
        "current_page": 1
    }
}
PUT /v1/farms/{id}
Rate Limit: 500/min Cost: ₦0.0050

Update Farm

Update an existing farm.

Example API Call

curl -X PUT "https://api.riwe.io/v1/farms/{id}" \
  -H "X-API-KEY: your_api_key_here"