Skip to main content

Add/Replace Scenario

Add a new scenario or replace an existing one.

info

Available in Contextal Platform 1.0 and later.

Request

  • Path: /api/v1/scenarios
  • Verb: PUT or POST
  • Content-Type: application/json
  • URL parameters:
    • replace_id: the id of an existing scenario to atomically delete (optional)
  • Body: JSON object with the following format (see the Scenarios section for more information):
    {
    "name": String,
    "min_ver": Number,
    "max_ver": Optional Number,
    "creator": String,
    "description": String,
    "local_query": String,
    "context": Optional Object,
    "action": String,
    }
    The Optional context object has this form:
    {
    "global_query": String,
    "min_matches": Number,
    }

Reply

On success:

  • Status: 201 - Created
  • Content-Type: application/json
  • Body: a JSON object with the following format:
    {
    "id": Number,
    "name": String,
    "creator": String,
    "description": String,
    "t": Date and time,
    "action": String,
    }

On failure:

  • Status: 409 - Conflict if the name of the scenario already exists
  • Status: 404 - Not Found if the replace_id parameter was provided but it does not match an existing scenario
  • Status: 4xx or 5xx