Using the Quicktate RESTful API to Add Accurate Transcription to Your Applications
Using the Quicktate RESTful API
Quicktate recently released a new RESTful API to help make integrating with the service a breeze. That said, while our new RESTful API documentation uses Swagger to generate our service documentation, many of the common RESTful semantics we rely on are completely missing from that documentation. Until we figure out an easier way to convey that information via Swagger, here’s some basic information on how to get around the API.
If you are a developer, you should contact Support to request free transcription while you develop and test your application. After creating an account you can log in and retrieve your API Key in Profile.
All requests currently are performed using HTTP Basic authentication. While we are still developing our OAuth provider and intend to use that as our primary mechanism for authenticating users, we currently are accepting your username and password via a standard HTTP Basic Authorization request. As a raw HTTP header, you are looking at the following for authenticating as email@example.com with password Test1234%:
As a cUrl request, you’ll be looking at using the -u firstname.lastname@example.org:Test1234%argument to the command.
The basis of Quicktate is transcriptions. However, while there is a /transcriptionresource for our API, you don’t actually create transcriptions - that’s the job of our typists. Instead, you submit a /transcriptionrequest to Quicktate and operate on that request until a typist has completed transcribing and turns it into a /transcription.
So, we expect very little in the HTTP headers for this type of request. Because you’re creating a new Transcription request, the method will be POST. What’s most important is the body of the request. Most developers are used to submitting the request as a form request, to where in a PHP application, the variables will come across in $_POST. In this case, however, we expect the body of the message to be either XML or JSON (as indicated in the Content-Type header).
What should be in the body of the message? The transcription request. When creating a transcription request for the first time, you’ll need to supply us with the following information:
The URL or e-mail address where a callback should occur upon completion of the transcription.
The way the callbackDestination should be invoked. This is mandatory if callbackDestination is specified. Valid values include: “HTTPPOST“, “RESTPOST“, “XMLRPC“, “EMAIL“.
Your custom metadata for this transcription request. This is sent back to you in the callback so that you have data you can trace back to some internal identifier or record.
Pretty self-explainatory. Valid values are: 1 = English, 2 = Spanish. Others on the way!
The URL of the audio file you wish to be downloaded and transcribed. Must be accessible from the internet. This is required if no “audiodata“ is present.
A Base 64 encoded block of the audio file to be transcribed. This is required if no “audiourl“ is present.
So, a sample HTTP request might look like the following:
What’s important to realize is that you will only have a successful request submitted when the status code returned is a 201. If you get a 400-level error message, check which one. If it’s a 401 or a 403, then you are not sending the proper credentials. If it’s just a 400 error, then you need to look at how you’re sending your data to the API, because the API doesn’t recognize the payload.
Once you’ve gotten past that, you may be wondering, how do I access the transcription request now? There is no body to this whatsoever. This is one of those REST semantics at play. If you look in the return headers, there is a Location header which specifies exactly where you can access your transcriptionRequest. Simply submit a GET request to that URL and you’ll find the status of your transcriptionRequest. The response will look something similar to the following:
That is, until your transcription is complete. Once your transcription is complete, the resource URL will permanently move. As a result, you’ll see the status code for the previous URL change from 200 to 302, indicating that it’s been permanently moved. Fortunately, we point you in the direction of where you need to go again, through the Location header: