Skip to content

Commit f91a402

Browse files
author
Alex Schworer
committed
Update readme docs with usage
1 parent 8f4ba51 commit f91a402

File tree

1 file changed

+204
-0
lines changed

1 file changed

+204
-0
lines changed

README.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,210 @@ zen = Zencoder(api_version='v1')
5555
# set to the edge version: https://app.zencoder.com/api/
5656
zen = Zencoder(api_version='edge')
5757
```
58+
59+
## Jobs
60+
61+
There's more you can do on jobs than anything else in the API. The following methods are available: `list`, `create`, `details`, `progress`, `resubmit`, `cancel`, `delete`.
62+
63+
### create
64+
65+
```python
66+
zen.job.create('s3://bucket/key.mp4')
67+
zen.job.create('s3://bucket/key.mp4',
68+
outputs=[{'label': 'vp8 for the web',
69+
'url': 's3://bucket/key_output.webm'}])
70+
```
71+
72+
This returns a `zencoder.Response` object. The body includes a Job ID, and one or more Output IDs (one for every output file created).
73+
74+
```python
75+
response = zen.job.create('s3://bucket/key.mp4')
76+
response.code # 201
77+
response.body['id'] # 12345
78+
```
79+
80+
### list
81+
82+
By default the jobs listing is paginated with 50 jobs per page and sorted by ID in descending order. You can pass two parameters to control the paging: `page` and `per_page`.
83+
84+
```python
85+
zen.job.list(per_page=10)
86+
zen.job.list(per_page=10, page=2)
87+
```
88+
89+
### details
90+
91+
The number passed to `details` is the ID of a Zencoder job.
92+
93+
```python
94+
zen.job.details(1)
95+
```
96+
97+
### progress
98+
99+
The number passed to `progress` is the ID of a Zencoder job.
100+
101+
```python
102+
zen.job.progress(1)
103+
```
104+
105+
### resubmit
106+
107+
The number passed to `resubmit` is the ID of a Zencoder job.
108+
109+
```python
110+
zen.job.resubmit(1)
111+
```
112+
113+
### cancel
114+
115+
The number passed to `cancel` is the ID of a Zencoder job.
116+
117+
```python
118+
zen.job.cancel(1)
119+
```
120+
121+
### delete
122+
123+
The number passed to `delete` is the ID of a Zencoder job.
124+
125+
```python
126+
zen.job.delete(1)
127+
```
128+
129+
## Inputs
130+
131+
### details
132+
133+
The number passed to `details` is the ID of a Zencoder job.
134+
135+
```python
136+
zen.input.details(1)
137+
```
138+
139+
### progress
140+
141+
The number passed to `progress` is the ID of a Zencoder job.
142+
143+
```python
144+
zen.input.progress(1)
145+
```
146+
147+
## Outputs
148+
149+
### details
150+
151+
The number passed to `details` is the ID of a Zencoder job.
152+
153+
```python
154+
zen.output.details(1)
155+
```
156+
157+
### progress
158+
159+
The number passed to `progress` is the ID of a Zencoder job.
160+
161+
```python
162+
zen.output.progress(1)
163+
```
164+
165+
## Accounts
166+
167+
### create
168+
169+
No API Key is required.
170+
171+
```python
172+
zen.account.create('[email protected]', tos=1)
173+
zen.account.create('[email protected]', tos=1,
174+
options={'password': 'abcd1234',
175+
'affiliate_code': 'foo'})
176+
```
177+
178+
### details
179+
180+
```python
181+
zen.account.details()
182+
```
183+
184+
### integration
185+
186+
This will put your account into integration mode (site-wide).
187+
188+
```python
189+
zen.account.integration()
190+
```
191+
192+
### live
193+
194+
This will put your account into live mode (site-wide).
195+
196+
```python
197+
zen.account.live()
198+
```
199+
200+
## Reports
201+
202+
### minutes
203+
204+
This will list the minutes used for your account within a certain, configurable range.
205+
206+
```python
207+
import datetime
208+
zen.report.minutes()
209+
zen.report.minutes(grouping="foo")
210+
zen.report.minutes(start_date=datetime.date(2011, 10, 30),
211+
end_date=datetime.date(2011, 11, 24))
212+
zen.report.minutes(start_date=datetime.date(2011, 10, 30),
213+
end_date=datetime.date(2011, 11, 24),
214+
grouping="foo")
215+
```
216+
217+
### vod
218+
219+
This will list the VOD minutes used for your account.
220+
221+
```python
222+
import datetime
223+
zen.report.vod()
224+
zen.report.vod(grouping="foo")
225+
zen.report.vod(start_date=datetime.date(2011, 10, 30),
226+
end_date=datetime.date(2011, 11, 24))
227+
zen.report.vod(start_date=datetime.date(2011, 10, 30),
228+
end_date=datetime.date(2011, 11, 24),
229+
grouping="foo")
230+
```
231+
232+
### live
233+
234+
This will list the Live transcoding minutes used for your account.
235+
236+
```python
237+
import datetime
238+
zen.report.live()
239+
zen.report.live(grouping="foo")
240+
zen.report.live(start_date=datetime.date(2011, 10, 30),
241+
end_date=datetime.date(2011, 11, 24))
242+
zen.report.live(start_date=datetime.date(2011, 10, 30),
243+
end_date=datetime.date(2011, 11, 24),
244+
grouping="foo")
245+
```
246+
247+
### all
248+
249+
This will list all of the transcoding minutes used for your account.
250+
251+
```python
252+
import datetime
253+
zen.report.all()
254+
zen.report.all(grouping="foo")
255+
zen.report.all(start_date=datetime.date(2011, 10, 30),
256+
end_date=datetime.date(2011, 11, 24))
257+
zen.report.all(start_date=datetime.date(2011, 10, 30),
258+
end_date=datetime.date(2011, 11, 24),
259+
grouping="foo")
260+
```
261+
58262
## Documentation
59263
Docs are in progress, and hosted at Read the Docs: http://zencoder.rtfd.org
60264

0 commit comments

Comments
 (0)