upsert_surveys

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

Input fields

field_sentera_id (ID!)

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

surveys ([SurveyImport!]!)

An array of SurveyImport objects to upsert. The limit is 2000 surveys.

Return fields

failed ([UpsertError!]!)

Detailed error information for UpsertItems that failed to upsert.

succeeded ([UpsertItem!]!)

UpsertItems that have been successfully upserted.

Examples

Upsert Surveys

Upserts an array of surveys for a given field.

Try this example in GraphiQL
mutation UpsertSurveys {       
  upsert_surveys(
    field_sentera_id: "pqqtjtt_AS_uhimAcme_CV_deve_1f796210b_220201_113149",
    surveys: [
      {
        name: "To create"
        start_time: "2022-01-31T20:57:29Z",
        end_time: "2022-02-01T20:57:29Z"
      },
      {
        sentera_id: "qkb36n9_CO_uhimAcme_CV_deve_1f796210b_220201_150621"
        name: "To update"
        start_time: "2022-01-31T20:57:29Z",
        end_time: "2022-02-01T20:57:29Z"
      },
      {
        name: "To fail"
      }
    ]
  ) {
    succeeded {
      action
      sentera_id
      ... on Survey {
        name
      }
    }
    failed {
      index
      attributes {
        attribute
        details
        message
        key
      }
    }
  }
}

{
  "data": {
    "upsert_surveys": {
      "succeeded": [
        {
          "action": "CREATE",
          "sentera_id": "c4wfs2r_CO_uhimAcme_CV_deve_1f796210b_220202_160915",
          "name": "To create"
        },
        {
          "action": "UPDATE",
          "sentera_id": "qkb36n9_CO_uhimAcme_CV_deve_1f796210b_220201_150621",
          "name": "To update"
        }
      ],
      "failed": [
        {
          "index": 2,
          "attributes": [
            {
              "attribute": "start_time",
              "details": {},
              "message": "can't be blank",
              "key": "blank"
            },
            {
              "attribute": "end_time",
              "details": {},
              "message": "can't be blank",
              "key": "blank"
            }
          ]
        }
      ]
    }
  }
}