Integrate Playwire™ On Your Site!
Using the Playwire™ API you can do everything related to video that you can on the Playwire site.
The first thing you will need to access the Playwire™ API is your API token. One was automatically created when you created a Playwire™ account. You can view your API token under your user name in the user list under Account > User Accounts. It will also be shown in the API Sandbox page.
The API token must be passed as a parameter named token, either as part of the URL in a GET request, or as another parameter in a POST request. Examples are shown on the API Reference page.
The Playwire™ API is an XML API, meaning all results from API calls are returned in XML. All URLs (before parameters) end in .xml when calling the API. Most programming languages should have libraries for dealing with XML. Please refer to developer documentation for your programming language of choice to learn how to work with XML in that language.
Several errors could come up while using the Playwire™ API. There are two types of errors which can come from the API:
- General Errors
- Field Validation Errors
General errors are in the form of XML like the following:
<message>Couldn't find Video with ID=12345</message>
There will be a fairly human-friendly error message and an error code. Possible error codes are:
- 1000 - Generic Error
- 2000 - Access Denied
- 3000 - Record Not Found
Field validation errors can occur on upload and updating requests and are in a format like this example:
<message>can't be blank</message>
There will be an error element for each field validation error. Each error will indicate which field had a validation error, and what the error was. This can be used to aid the user to correct the error. The above example is saying that the name field was blank, which is not allowed for videos.
General errors and field validation errors can be differentiated by their root element, which is error for general errors and errors for field validation errors. As shown in the example, even if only one field had an error, the field validations error root element will still be errors. Applications using the API should be able to deal with multiple errors in field validation error responses.
In addition whenever field validation errors occur on one or many fields, no other fields are updated, even if they were otherwise correct.
Language API Client Libraries
The Playwire™ team has developed an API client library for the Playwire™ API for PHP, with other common programming languages to be supported in the future. These clients will make it as easy as possible to use the Playwire™ API from those languages. To learn more about the current PHP client, check out the API Clients page.
To learn the various REST requests available in the API, please refer to the API Reference.