POST /processes/:processId/play

Description

Play a process. Playing a process causes its state to change.

It returns an array containing:

  • The new triggers that become available
  • The updated scores of the player
  • Any events that occured

Resource URL

https://api.playlyfe.com/:processId/play

Method

POST

Scopes

player, game, debug

Parameters

LocationParameter NameDefault ValueDescription
QueryprocessIdThe process ID

Example

Request
POST https://api.playlyfe.com/processes/neo/therealmatrix/play
{
  "trigger": "try_to_save_the_world:choose_your_path"
}
Response
[
  [
    {
      "trigger": "brahmastra:choose_your_weapon",
      "name": "Brahmastra",
      "actions": [
        {
          "metric": {
            "id": "weapons",
            "type": "set",
            "name": "Weapons"
          },
          "value": {
            "Bhramastra": "1"
          },
          "verb": "add"
        }
      ]
    },
    {
      "trigger": "excalibur:choose_your_weapon",
      "name": "Excalibur",
      "actions": [
        {
          "metric": {
            "id": "weapons",
            "type": "set",
            "name": "Weapons"
          },
          "value": {
            "Excalibur": "1"
          },
          "verb": "add"
        }
      ]
    },
    {
      "trigger": "mjolinir:choose_your_weapon",
      "name": "Mjolinir",
      "actions": [
        {
          "metric": {
            "id": "weapons",
            "type": "set",
            "name": "Weapons"
          },
          "value": {
            "Mjolinir": "1"
          },
          "verb": "add"
        }
      ]
    }
  ],
  [
    {
      "metric": {
        "id": "existential_plane",
        "name": "Existential Plane",
        "type": "state"
      },
      "value": {
        "name": "Material",
        "description": "The plane of human beings"
      }
    },
    {
      "metric": {
        "id": "karma",
        "name": "Karma",
        "type": "point"
      },
      "value": "2000000002"
    }
  ],
  {
    "local": [
      {
        "event": "progress",
        "activity": {
          "id": "try_to_save_the_world",
          "name": "Try to save the World"
        },
        "actor": {
          "id": "neo",
          "alias": "Neo"
        },
        "changes": [
          {
            "metric": {
              "id": "karma",
              "name": "Karma",
              "type": "point"
            },
            "delta": {
              "old": "1000000001",
              "new": "2000000002"
            }
          }
        ],
        "timestamp": "2014-03-02T17:47:04.260Z",
        "id": "aa6d4840-a232-11e3-9af5-753d0e60669a"
      }
    ],
    "global": []
  }
]