Process Flow Trigger APIs
#########################

In some scenarios, the PPS operator process flow waits for external trigger(s)
for some action. This section details such trigger APIs.

.. warning:: Having a synchronous external dependency in the process flow is not
             usually recommended because it can block the process flow and can
             cause a decrease in throughput.

Print Ready API
***************

This API is useful for the cases when printing (e.g, invoice printing) for an
order is done by a different system. This trigger endpoint can be used to notify
GreyMatter that printing has been done and the process flow for that order/bin
can resume.

.. http:post:: /api-gateway/integration-service/wms-integration/butler/api/orders/print_ready/(externalServiceRequestId)

   :reqheader Content-Type: the request's content-type has to be passed in this
                            header
   :reqheader Accept: the response content type depends on
                      :mailheader:`Accept` header
   :reqheader Authorization: OAuth token to authenticate

   :param string externalServiceRequestId: :js:data:`externalServiceRequestId`
          of the :ref:`Service Request Object` which refers to the order.

   :statuscode 200: Successful
   :statuscode 404: Service Request Id not found
   :statuscode 400: Can be due to invalid order status


   **Example request**:

   .. sourcecode:: http

      POST /api-gateway/integration-service/wms-integration/butler/api/orders/print_ready/PICK-123 HTTP/1.1
      Host: example.com
      Content-Type: application/json
      Accept: application/json, text/javascript

   **Example Response**:

   .. sourcecode:: http

      HTTP/1.1 200 OK