sync_files

Retrieve a list of files that have changed.

Arguments

content_hashes ([String!]!)

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

owners ([FileOwnerInput!]!)

An array of types of owners to which the files belong.

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 files for file owners

This query is used by a client to sync files for multiple file owners. This query will return up to the first 2,000 files that are different from the files held by the client. To retrieve the remaining files, the client should call the query repeatedly, passing in the full set of content hashes for the files it holds, until no more files are returned, or the remaining count returned is 0.

Try this example in GraphiQL
query SyncFiles{
  sync_files(
  owners: [
    {
      owner_type: SURVEY,
      sentera_id: "j35az4m_CO_gg0kAcme_CV_deve_72f524141_211118_090537"
    },
    {
     owner_type: MOSAIC,
      sentera_id: "j35az4m_MO_gg0kAcme_CV_deve_72f524141_211118_090537"
    },
    {
      owner_type: FIELD,
      sentera_id: "j35az4m_AS_gg0kAcme_CV_deve_72f524141_211118_090537"
    },
    {
      owner_type: FEATURE_SET,
      sentera_id: "j35az4m_FS_gg0kAcme_CV_deve_72f524141_211118_090537"
    },
    {
      owner_type: LOGO,
      sentera_id: "rm363yb_LO_vrw6Acme_CV_deve_5ccf1e6f4_220119_174649"
    }
  ],
  content_hashes: [
    "NG0/FA8a1cO4C+y2",
    "n0VjjgvV44vx2/8"
  ]
  ) {
    remaining_count
    upserted {
      sentera_id
      ... on File {
        action
        download_filename
        filename
        file_owner {
          owner_type,
          sentera_id
        }
      }
      content_hash,
      created_by {
        last_name
      }
    }
    deleted {
      ... on File {
        filename
      }
      content_hash,
      sentera_id
    }
    failed {
      key,
      message,
      details
    }
  }
}

{
  "data": {
  "sync_files": {
    "remaining_count": 0,
    "upserted": [
      {
        "sentera_id": "j35az4m_FI_gg0kAcme_CV_deve_72f524141_211118_090537",
        "action": "UPDATE",
        "download_filename": "example.txt",
        "filename": "example.txt",
        "file_owner": {
          "owner_type": "SURVEY",
          "sentera_id": "j35az4m_CO_gg0kAcme_CV_deve_72f524141_211118_090537"
        },
        "content_hash": "n0VjjgvV44vx2/8/",
        "created_by": {
          "last_name": "Luitel"
        }
      },
      {
        "sentera_id": "j35az4m_FI_gg0kAcme_CV_deve_72f524141_211118_090537",
        "action": "CREATE",
        "download_filename": "example.tif",
        "filename": "example.tif",
        "file_owner": {
          "owner_type": "MOSAIC",
          "sentera_id": "j35az4m_MO_gg0kAcme_CV_deve_72f524141_211118_090537"
        },
        "content_hash": "IAQufmgxPqo1IidG",
        "created_by": {
          "last_name": "Orton"
        }
      },
      {
        "sentera_id": "j35az4m_FI_gg0kAcme_CV_deve_72f524141_211118_090537",
        "action": "CREATE",
        "download_filename": "example.csv",
        "filename": "example.csv",
        "file_owner": {
          "owner_type": "FIELD",
          "sentera_id": "j35az4m_AS_gg0kAcme_CV_deve_72f524141_211118_090537"
        },
        "content_hash": "Aid1/re6NcEl3YRx",
        "created_by": {
          "last_name": "Liow"
        }
      },
      {
        "sentera_id": "1txyj94_FI_vrw6Acme_CV_deve_5ccf1e6f4_220119_174649",
        "action": "UPDATE",
        "download_filename": "logo.png",
        "filename": "logo.png",
        "file_owner": {
          "owner_type": "LOGO",
          "sentera_id": "rm363yb_LO_vrw6Acme_CV_deve_5ccf1e6f4_220119_174649"
        },
        "content_hash": "H8l9sj4+dLWuo3Ag",
        "created_by": {
          "last_name": "Allen"
        }
      }
    ],
    "deleted": [
      {
        "filename": "example.prj",
        "content_hash": "IXYzC5KogGqYKqbU",
        "sentera_id": "j35az4m_FI_gg0kAcme_CV_deve_72f524141_211118_090537"
      }
    ],
    "failed": [
      {
        "key": "invalid_object",
        "message": "Invalid owner",
        "details": {
          "owner_type": "FEATURE_SET",
          "sentera_id": "j35az4m_FS_gg0kAcme_CV_deve_72f524141_211118_090537"
        }
      }
    ]
  }
  }
}