This is a PHP
wrapper for the Wistia Data Api. A full list of Objects and Methods are at the bottom.
Basic usage:
//Your wistia api key
$apikey = "abcdefg123456";
//A wistia media id
$media_id = "xyz123";
//Get a Medias Resource
$media = \Wistia\Wistia::getResource("Medias", $apikey);
//Call the Api Method on the resource
$results = $media->show($media_id);
//Now test if api call was successful
if($results->isSuccess()){
//It was successful
//now get results
//and do something
echo $results->getResults();
}else{
//Not successful
//So do something
echo $results->getStatus();
}
Scenario 1: If you wanted to `show` a particular project with the id of `xyz123`
//Your wistia api key
$apikey = "abcdefg123456";
$project_id = "xyz123";
//Get Projects Resource
$projects = \Wistia\Wistia::getResource("Projects", $apikey);
//Then call the method on the project
$results = $projects->show($project_id);
Scenario 2: If you wanted to `delete` a caption for a video `xyz123` with language `eng`
//Your wistia api key
$apikey = "abcdefg123456";
$media_id = "xyz123";
//Get Captions Object
$captions = \Wistia\Wistia::getResource("Captions", $apikey);
//Then call the method on captions
$results = $captions->delete($media_id, array(
"language" => "eng"
));
The `$results` you receive from the methods is a simple object with three methods.
$results = $projects->show("project id");
//Get Status Code from Response Header
$results->getStatus(); //200 or 201 or 404 ...
//Get Response JSON string
$results->getResults(); //{"wistia":"json"}
//Test if result is Successful
//returns true if status === 200 or 201
//and false for everything else
$results->isSuccess();
If for some weird reason you would like to instantiate the classes directly, you can!
//Your wistia api key
$apikey = "abcdefg123456";
$media_id = "xyz123";
//Get Captions Object
$captions = new \Wistia\Resources\Captions($apikey);
//Then call the method on captions
$results = $captions->delete($media_id, array(
"language"
));
The full list of Objects, Methods and their parameters, map directly to the Wistia Data Api (for the most part). Any place wistia uses `list` we have to use `listOf`, since list is a protected word in php. The break down of the list below is `Object -> Method -> Parameter`. `[$param] = Optional parameter`
-
Projects
- listOf
- [$params] - wistia api parameters see Wistia documentation
- show
- $project_id - wistia api hashed project id
- [$params] - wistia api parameters see Wistia documentation
- create
- [$params] - wistia api parameters see Wistia documentation
- update
- $project_id - wistia api hashed project id
- [$params] - wistia api parameters see Wistia documentation
- delete
- $project_id - wistia api hashed project id
- [$params] - wistia api parameters see Wistia documentation
- copy
- $project_id - wistia api hashed project id
- [$params] - wistia api parameters see Wistia documentation
- listOf
-
Sharings
- listOf
- $project_id - wistia api hashed project id
- [$params] - wistia api parameters see Wistia documentation
- show
- $project_id - wistia api hashed project id
- $sharing_id - wistia api hashed sharing id
- [$params] - wistia api parameters see Wistia documentation
- create
- $project_id - wistia api hashed project id
- [$params] - wistia api parameters see Wistia documentation
- update
- $project_id - wistia api hashed project id
- $sharing_id - wistia api hashed sharing id
- [$params] - wistia api parameters see Wistia documentation
- delete
- $project_id - wistia api hashed project id
- $sharing_id - wistia api hashed sharing id
- [$params] - wistia api parameters see Wistia documentation
- listOf
-
Medias
- listOf
- [$params] - wistia api parameters see Wistia documentation
- show
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- update
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- delete
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- copy
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- stats
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- listOf
-
Account
- get
- [$params] - wistia api parameters see Wistia documentation
- get
-
Customizations
- show
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- create
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- update
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- delete
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- show
-
Captions
- index
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- create
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- show
- $media_id - wistia api hashed media id
- $language_code - ISO-639-2 language code - three letter code
- [$params] - wistia api parameters see Wistia documentation
- update
- $media_id - wistia api hashed media id
- $language_code - ISO-639-2 language code - three letter code
- [$params] - wistia api parameters see Wistia documentation
- delete
- $media_id - wistia api hashed media id
- $language_code - ISO-639-2 language code - three letter code
- [$params] - wistia api parameters see Wistia documentation
- purchase
- $media_id - wistia api hashed media id
- [$params] - wistia api parameters see Wistia documentation
- index