sync_shapes

Retrieve a list of shapes that have changed.

Arguments

content_hashes ([String!]!)

An array of content hashes for shapes the client has previously retrieved. The server will return shapes whose content hashes do not match the client's content hashes.

field_sentera_id (ID!)

The ID of the field containing the shapes to be synced.

Return fields

deleted ([SyncItem!]!)

Items that have been deleted.

failed ([SyncError!])

A list describing errors that occurred during the syncing process.

remaining_count (Int!)

The number of items remaining to be synced.

upserted ([SyncItem!]!)

Items that have been inserted or updated.

Examples

Sync Shapes for a field

This query is used by a client to sync shapes for a specific field with shapes stored on the server. This query will return up to the first 200 shapes in a field that are different from the shapes held by the client. To retrieve the remaining shapes, a client should call this query repeatedly, passing in the full set of content hashes for shapes it holds, until no more shapes are returned, or the remaining count returned is 0.

Try this example in GraphiQL
query SyncFieldShapes {
  sync_shapes(
  field_sentera_id: "d099aoj_AS_h2b3Acme_CV_deve_040c29409_220110_115407"
  content_hashes: [
    "xdNDk/aet07YA1pi"
    "/h9Kp8h1wLAR77g6"
    "pZCIzimW+sJQ1tPP"
  ]
  ) {
  remaining_count
  upserted {
    sentera_id
    content_hash
    created_at
    created_by {
        sentera_id
    }
    ... on Shape {
      name
      color
      reference_date
      area(unit_system: IMPERIAL) {
        unit
        value
      }
      geometry
    }
  }
  deleted {
    sentera_id
    content_hash
  }
  }
}

{
  "data": {
  "sync_shapes": {
    "remaining_count": 0,
    "upserted": [
      {
        "sentera_id": "g1hkkbv_SH_h2b3Acme_CV_deve_040c29409_220110_115408",
        "content_hash": "BKBbPZJ1hdKCqFIw",
        "created_at": "2022-01-10T17:54:08Z",
        "created_by": {
          "sentera_id": "2i6ad4y_US_h2b3Acme_CV_deve_040c29409_220110_115406"
        },
        "name": "Hello",
        "color": "#FF0000",
        "reference_date": "2021-01-06",
        "area": {
          "unit": "ACRE",
          "value": 1
        },
        "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": {}
            }
          ]
        }
      }
    ],
    "deleted": [
      {
        "content_hash": "BKBbPZJ1hdKCqFIw",
        "sentera_id": "g1hkkbv_SH_h2b3Acme_CV_deve_040c29409_220110_225897"
      }
    ]
  }
  }
}