Update Availability Rule

You can update the properties of an availability entry using the updateAvailability mutation. You can also add and remove dimensions.

🚧

This operation can take some time, and will take longer depending on how many objects are linked to the availability rule that you're updating.

This is because when you update an availability rule, the availability for all its related objects need to be recalculated. At present this operation takes place synchronously as part of the update, however in future iterations this will be moved to an async task for convenience.

This example shows updating an end date.

mutation updateAvailability {
  updateAvailability(
    uid: "d53332c0-6ed6-4c97-996f-b5bc4982ba98", 
    availability: {end: "2023-01-01T00:00:00Z"}
  ) {
    # Return fields
    uid
    start
    end
  }
}

Response:

{
  "data": {
    "updateAvailability": {
      "uid": "d53332c0-6ed6-4c97-996f-b5bc4982ba98",
      "start": "2020-01-01T00:00:00Z",
      "end": "2023-01-01T00:00:00Z"
    }
  }
}

This example shows how to remove a dimension value from availability.

mutation updateAvailability {
  updateAvailability(
    uid: "d53332c0-6ed6-4c97-996f-b5bc4982ba98", 
    availability: {
      dimensions: {
        unlink: [
          {
            dimension_slug: "operating-system",
            value_slugs: ["ios"]
          }
        ]
      }
    }
  ) {
    # Return fields
    uid
    start
    end
  }
}

Reponse:

{
  "data": {
    "updateAvailability": {
      "uid": "d53332c0-6ed6-4c97-996f-b5bc4982ba98",
      "start": "2020-01-01T00:00:00Z",
      "end": "2023-01-01T00:00:00Z"
    }
  }
}