Skip to content

Farm Crops

Description

Fields

FieldDescriptionData Type
idUnique identifier for the objectUUID
societyIdIdentifier for the objectString
cropIdIdentifier type of enterpriseNumber
createdAtTimestamp of when the object was createdString
updatedAtTimestamp of the last update to the objectString
deletedAtTimestamp of when the object was deleted, or null if not deletedString or null

List Farm Crops

http
GET /farm-crops?societyId=<societyId>

Response

json
{
  "data": [
    {
      "id": "36ebf6d4-2c95-4c26-84f3-b329e1de20f2",
      "societyId": "B90355322",
      "cropId": 1,
      "createdAt": "2024-12-16T09:35:39.077Z",
      "updatedAt": "2024-12-16T09:35:39.077Z",
      "deletedAt": null,
      "crop": {
        "id": 1,
        "name": "OLIVAR INTENSIVO",
        "domainId": "AGG",
        "createdAt": "2024-12-13T18:51:46.508Z",
        "updatedAt": "2024-12-13T18:51:46.508Z",
        "deletedAt": null
      }
    }
  ],
  "meta": {
    "itemsPerPage": 20,
    "totalItems": 1,
    "currentPage": 1,
    "totalPages": 1,
    "sortBy": [
      [
        "createdAt",
        "DESC"
      ]
    ]
  },
  "links": {
    "current": "http://api-dev.aggraria.digital/v1.0/societies/B90355322/farm-crop?page=1&limit=20&sortBy=createdAt:DESC&societyId=B90355322"
  }
}

Create Farm Crops

http
POST /farm-crops?societyId=<societyId>

Request body

json
{
  "id": "b002e18a-43bd-4077-b501-e3e3cc4d38a2",
  "cropId": 1
}

Response body

json
{
  "id": "b002e18a-43bd-4077-b501-e3e3cc4d38a2",
  "societyId": "B90355322",
  "cropId": 1,
  "updatedAt": "2024-12-20T02:39:26.263Z",
  "createdAt": "2024-12-20T02:39:26.263Z",
  "deletedAt": null
}

Update Farm Crops

http
PATCH /farm-crops/<id>?societyId=<societyId>

Request body

json
{
  "cropId": 2
}

Response body

json
{
  "generatedMaps": [],
  "raw": [],
  "affected": 1
}

Delete Farm Crops

http
DELETE /farm-crops/<id>?societyId=<societyId>

Response body

json
{
  "generatedMaps": [],
  "raw": [],
  "affected": 1
}