Order > Transition orders

To change the status of an order we use transitions. These allow Telefakt to accurately control what happens to dates and statuses inside an order and allow consumers an easy way to perform complex operations. Transitioning an order consists of two steps, first GET the available transitions for a order and then PUT the transition id you want to perform on the order you want to perform it on. Transitions are one way trips and unless there is a specific sequence of transitions to take you back to the state you were in there is no easy way to undo the transition at the moment. Such sequences of transitions exist for a couple of different reasons, the most prevalent is error handling, the status an order could go through could look something like this: DLNW -> DLRD -> DLER -> DLNW, in other words, we move from DeLivery NeW to DeLivery ReciveD then an error happens and we go to DeLivery ErroR before someone resolves the error and tries again by issusing a transition to DeLivery NeW - and we are back where we started.

get

All transitions of an order

This request will return all the valid transitions for the order specified by :order_id in its current state. If there are no available transitions that either means that the order has reached the end of a path of transitions, meaning it can no longer change status. Or it has become malformed, transitions require that every line in the order adheres to rules of the transition and if any of the lines break those rules then the transition is not available for the order.

order_idint

required

Example
"1234"

Responses

Response examples

Successful response

{
  "items": [
    {
      "id": 1985,
      "new_status": "VUCH",
      "name": "Order",
      "system_use_only": 1,
      "button_text": [
        {
          "language_id": 1,
          "text": "Bestill"
        },
        {
          "language_id": 0,
          "text": "Order"
        }
      ],
      "description_text": [
        {
          "language_id": 1,
          "text": "Bestill"
        },
        {
          "language_id": 0,
          "text": "Order"
        }
      ],
      "result_text": null,
      "links": [
        {
          "rel": "run this transition",
          "href": "https://redacted/data/order/897487/transition/1985"
        }
      ]
    },
    {
      "id": 1980,
      "new_status": "HOLD",
      "name": "Put on hold",
      "system_use_only": 1,
      "button_text": [
        {
          "language_id": 0,
          "text": "Put on hold"
        },
        {
          "language_id": 1,
          "text": "Sett på vent"
        }
      ],
      "description_text": [
        {
          "language_id": 0,
          "text": "Put on hold"
        },
        {
          "language_id": 1,
          "text": "Sett på vent"
        }
      ],
      "result_text": null,
      "links": [
        {
          "rel": "run this transition",
          "href": "https://redacted/data/order/897487/transition/1980"
        }
      ]
    },
    {
      "id": 401,
      "new_status": "CANC",
      "name": "Nysalg tapt",
      "system_use_only": 0,
      "button_text": [
        {
          "language_id": 1,
          "text": "Tapt"
        },
        {
          "language_id": 0,
          "text": "Lost"
        }
      ],
      "description_text": [
        {
          "language_id": 1,
          "text": "Ordren er avbestilt (tapt)"
        },
        {
          "language_id": 0,
          "text": "Order is cancelled(lost)"
        }
      ],
      "result_text": null,
      "links": [
        {
          "rel": "run this transition",
          "href": "https://redacted/data/order/897487/transition/401"
        }
      ]
    },
    {
      "id": 330,
      "new_status": "DLNW",
      "name": "Bestill nysalg",
      "system_use_only": 0,
      "button_text": [
        {
          "language_id": 1,
          "text": "Bestill"
        },
        {
          "language_id": 0,
          "text": "Order"
        }
      ],
      "description_text": [
        {
          "language_id": 1,
          "text": "Bestill"
        },
        {
          "language_id": 0,
          "text": "Order"
        }
      ],
      "result_text": null,
      "links": [
        {
          "rel": "run this transition",
          "href": "https://redacted/data/order/897487/transition/330"
        }
      ]
    }
  ]
}
put

Run a transition

This request runs the specified :transition_id on the specified :order_id. Not that this operation is not easily reversible.

order_idint

required

Example
"1234"
transition_idint

required

Example
"330"

Responses

Response examples

Successful response

Empty response

Was this page helpful?