Step 2: Place the order

You may place an order by sending an HTTP POST request to https://api-sandbox.rev.com/api/v1/orders. This URL is the same across all service lines.

The body of a request varies depending on the order type. All order types have a Service Options element that specifies information that corresponds to its type. There is also an optional Notification element which you may use to set up webhooks in order to be notified about the status of an order.

Let's go back to the console and place a sample Captions order, using the file we provided in the previous example. For a list of file formats we can produce for each type of service, please go to www.rev.com and read our FAQs. Let's have Rev to produce a SubRip (.srt) caption file. This is the body of the message required to place the order:

{
   "caption_options": {
      "inputs": [
         {
            "uri": "urn:rev:inputmedia:43939absfziow"
         }
      ],
      "output_file_formats": [
         "SubRip"
      ]
   }
}

Look at the contents of the uri element of the body. It is the same URI we received through the Location header of the response in Step 1.

And this is how you would do it through the console:

curl -H "Authorization: Rev [ClientAPIKey]:[UserAPIKey]" -H "Content-Type: application/json" \ https://api-sandbox.rev.com/api/v1/orders \
--data "{'caption_options': {'inputs': [{'uri': 'urn:rev:inputmedia:43939absfziow'}],'output_file_formats': [ 'SubRip' ]}}" -D  -

An HTTP response similar to the following one will be printed out:

HTTP/1.1 201 Created
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Location: https://api-sandbox.rev.com/api/v1/orders/CP0000000000
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
Date: Mon, 11 Jan 2016 23:48:39 GMT
Content-Length: 0

Again, we highlight in bold the relevant parts. The response of a successfully placed order will contain two main things: an HTTP 201 response code indicating order creation, and a Location header containing an API URL you can use to later track the status of the new order.

You can verify the order was created by opening up your browser and logging into https://api-sandbox.rev.com. If you go to the Order History page, an entry with the same order number as the one received in the Location header of the order placement request should appear.

For a detailed description of placing orders, please visit Placing Caption Orders and Placing Transcription Orders.