https://github.com/opsmatters/wistia-api
Wistia Java v1 API
https://github.com/opsmatters/wistia-api
Last synced: 12 months ago
JSON representation
Wistia Java v1 API
- Host: GitHub
- URL: https://github.com/opsmatters/wistia-api
- Owner: opsmatters
- Created: 2019-08-04T01:15:59.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-05T16:14:57.000Z (about 5 years ago)
- Last Synced: 2023-03-21T23:53:49.418Z (over 3 years ago)
- Language: Java
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Java Wistia API v1.
To use this api you’ll first need to obtain an API key from Wistia:
https://wistia.com/support/developers/data-api
The generated token is all you need to use the Java Wistia API.
```java
package com.opsmatters.wistia;
import java.io.File;
import org.json.JSONObject;
import org.json.JSONArray;
public class WistiaTest
{
public static void main(String[] args) throws Exception
{
Wistia wistia = new Wistia("");
// List videos
{
WistiaResponse result = wistia.get("/medias.json");
JSONArray items = result.getJsonArray();
if(items != null && items.length() > 0)
{
for(int i = 0; i < items.length(); i++)
{
JSONObject item = items.getJSONObject(i);
System.out.println(item.optString("name"));
}
}
}
// Get video details
String hashedId = "x123456y";
WistiaResponse result = wistia.get(String.format("/medias/%s.json", hashedId));
JSONObject item = result.getJson();
System.out.println(item.optString("name"));
}
}
```
The class WistiaResponse provides a response code and JSON response, see the Wistia API documentation in case of errors.
### Use with Maven
```xml
com.opsmatters
wistia-api
1.0.0
```