upsert_files

Upsert (create and/or update) one or more files

Input fields

files ([FileImport!]!)

An array of FileImport objects to upsert. The limit is 1000 files.

owner (FileOwnerInput!)

The owner to which these files should 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 Files

Upserts an array of files

Try this example in GraphiQL
mutation UpsertFilesExample {
  upsert_files(
  owner: {
    owner_type: SURVEY
    sentera_id: "58ag1kg_CO_c9hoAcme123_AD_u1qxybut_ac5d85f7_190711_163140"
  }
  files: [
    {
      file_type: UAV_METADATA
      filename: "gps.csv"
      path: "e4w83x7_CO_3ncuAcme123_AD_u1qxybut_b6d7b92e3_20211102_221407\\NDVI_Data"
      size: 901600
      version: 1
    },
    {
      filename: "gps.csv"
    }
  ]
  ) {
  succeeded {
    sentera_id
    ... on File {
      content_hash
      file_type
      filename
      path
      size
      version
      created_by {
        sentera_id
      }
      updated_by {
        sentera_id
      }
    }
  }
  failed {
    index
    item {
      sentera_id
      ... on File {
        filename
      }
    }
    attributes {
      attribute
      key
      details
      message
    }
  }
  }
}

{
  "data": {
  "upsert_files": {
    "succeeded": [
      {
        "content_hash": "xdNDk/aet07YA1pi",
        "sentera_id": "5eak2ij_FI_tcb5Acme123_CV_deve_ee0ea476d_211117_085537",
        "file_type": "uav_metadata",
        "filename": "gps.csv",
        "path": "e4w83x7_CO_tcb5Acme123_AD_u1qxybut_b6d7b92e3_20211102_221407\\NDVI_Data",
        "size": 901600,
        "version": 1,
        "created_by": {
          "sentera_id": "rczsi42_US_tcb5Acme123_CV_stag_e3e4835_210209_171134"
        },
        "updated_by": {
          "sentera_id": "rczsi42_US_tcb5Acme123_CV_stag_e3e4835_210209_171134"
        }
      }
    ],
    "failed": [
      {
        "index": 1,
        "item": {
          "sentera_id": "3n5y00f_FI_tcb5Acme123_CV_deve_ee0ea476d_211117_085537",
          "filename": "gps.csv"
        },
        "attributes": [
          {
            "attribute": "file_type",
            "key": "blank",
            "details": {},
            "message": "can't be blank"
          }
        ]
      }
    ]
  }
  }
}