upsert_shapes

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

Input fields

field_sentera_id (ID!)

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

shapes ([ShapeImport!]!)

An array of ShapeImport objects to upsert. The limit is 200 shapes.

Return fields

failed ([UpsertError!]!)

Detailed error information for UpsertItems that failed to upsert.

succeeded ([UpsertItem!]!)

UpsertItems that have been successfully upserted.

Examples

Upsert Shapes

Upserts an array of shapes for a given field.

Try this example in GraphiQL
mutation UpsertShapes {
  upsert_shapes(
  field_sentera_id: "lxa6ug9_AS_m25qAcme_CV_deve_ecaf91aa2_220105_135248",
  shapes: [
  {
    sentera_id: "fuo6bgy_SH_m25qAcme_CV_deve_ecaf91aa2_220105_143140",
    name: "to update"
  },
  {
    name: "to fail",
    color: "#FF0000",
    reference_date: "2021-01-07"
  }
  ]) {
  succeeded {
    action
    sentera_id
    ... on Shape {
      name
      geometry
    }
  }
  failed {
    index
    attributes {
      attribute
      key
      details
      message
    }
  }
  }
}

{
  "data": {
  "upsert_shapes": {
    "succeeded": [
      {
        "action": "UPDATE",
        "sentera_id": "0pjoohk_SH_m25qAcme_CV_deve_ecaf91aa2_220106_144932",
        "name": "to update",
        "geometry": {
          "type": "FeatureCollection",
          "features": [
            {
              "type": "Feature",
              "geometry": {
                "type": "GeometryCollection",
                "geometries": [
                  {
                    "type": "Polygon",
                    "coordinates": [
                      [
                        [
                          -92.5948,
                          45.0946
                        ],
                        [
                          -92.5885,
                          45.0947
                        ],
                        [
                          -92.5893,
                          45.0933
                        ],
                        [
                          -92.5948,
                          45.0946
                        ]
                      ],
                      [
                        [
                          -92.5915,
                          45.0939
                        ],
                        [
                          -92.5895,
                          45.0945
                        ],
                        [
                          -92.5908,
                          45.0944
                        ],
                        [
                          -92.5915,
                          45.0939
                        ]
                      ]
                    ]
                  }
                ]
              },
              "properties": {}
            }
          ]
        }
      }
    ],
    "failed": [
      {
        "index": 2,
        "attributes": [
          {
            "attribute": "geometry",
            "key": "blank",
            "details": {},
            "message": "has invalid coordinates"
          },
          {
            "attribute": "geometry",
            "key": "invalid_geometry_collection",
            "details": {},
            "message": "is not a GeometryCollection"
          }
        ]
      }
    ]
  }
  }
}