upsert_crop_seasons

Upsert (create and/or update) one or more crop seasons for a field.

Input fields

crop_seasons ([CropSeasonImport!]!)

An array of CropSeasonImport objects to upsert. The limit is 2000 crop seasons.

field_sentera_id (ID!)

The ID of the Field into which these Crop Seasons will be upserted.

Return fields

failed ([UpsertError!]!)

Detailed error information for UpsertItems that failed to upsert.

succeeded ([UpsertItem!]!)

UpsertItems that have been successfully upserted.

Examples

Upsert Crop Seasons

Upserts an array of crop seasons for a given field.

Try this example in GraphiQL
mutation UpsertCropSeasons {       
  upsert_crop_seasons(
  field_sentera_id: "nlnb1fw_AS_f5kyAcme_CV_deve_b72660b4f_220316_081439",
  crop_seasons: [
    {
      name: "To create"
      crop_type: CORN
      started_at: "2022-03-17T13:45:20Z",
      ended_at: "2022-04-17T13:45:20Z"
    },
    {
      sentera_id: "5feotck_CS_f5kyAcme_CV_deve_b72660b4f_220316_081440"
      name: "To update"
      ended_at: "2022-04-17T13:45:20Z"
    },
    {
      name: "To fail"
    }
  ]
  ) {
  succeeded {
    action
    sentera_id
    ... on CropSeason {
      name
      crop_type
    }
  }
  failed {
    index
    attributes {
      attribute
      details
      message
      key
    }
  }
  }
}

{
  "data": {
  "upsert_crop_seasons": {
    "succeeded": [
      {
        "action": "CREATE",
        "sentera_id": "pu7zsyx_CS_f5kyAcme_CV_deve_b72660b4f_220317_084614",
        "name": "To create",
        "crop_type": "CORN"
      },
      {
        "action": "UPDATE",
        "sentera_id": "5feotck_CS_f5kyAcme_CV_deve_b72660b4f_220316_081440",
        "name": "To update",
        "crop_type": "CORN"
      }
    ],
    "failed": [
      {
        "index": 2,
        "attributes": [
          {
            "attribute": "started_at",
            "details": {},
            "message": "can't be blank",
            "key": "blank"
          }
        ]
      }
    ]
  }
  }
}