API Endpoints¶
The API
is documented here.
Feel free to use cURL
and python
to look at formatted json respone. You can
also look at them in your browser, if it handles returned json.
curl http://twipodcast.herokuapp.com | python -m json.tool
Base¶
-
GET
/
¶ Retrieve author and project info
Example response:
{ "author": "Sandip Bhagat", "author_url": "http://sandipbgt.github.io", "base_url": "https://twipodcast.herokuapp.com", "project_name": "twipodcast", "project_url": "https://github.com/sandipbgt/twipodcast", 'api': 'https://twipodcast.herokuapp.com/api' }
API Base¶
-
GET
/api
¶ Retrieve list of api resources.
Example response:
{ 'soundcloud': 'https://twipodcast.herokuapp.com/api/soundcloud', 'calls': 'https://twipodcast.herokuapp.com/api/calls', 'feedback': 'https://twipodcast.herokuapp.com/api/feedback' }
Soundcloud¶
-
GET
/api/soundcloud
¶ Retrieve soundcloud podcaster’s username list
Example response:
{ "life": [ "theordinarylife_podcast" ], "python": [ "talkpython" ], "startup": [ "indiastartupchat", "hearstartup", "trevorpage-1", "twistartups" ] }
-
GET
/api/soundcloud/
(string: username)¶ Retrive soundcloud user’s tracks list
Parameters: - userame – soundcloud username
Example response:
{ "tracks": [ { "permalink_url": "http://soundcloud.com/talkpython/episode-33-openstack-cloud-computing-built-on-python", "stream_url": "https://api.soundcloud.com/tracks/232430011/stream", "title": "Episode #33: OpenStack: Cloud computing built on Python" }, { "permalink_url": "http://soundcloud.com/talkpython/32-pypyjs-pypy-python-in-your-browser", "stream_url": "https://api.soundcloud.com/tracks/231487315/stream", "title": "#32: PyPy.js - PyPy Python in Your Browser" }, ... ] }
Calls¶
-
GET
/api/calls/say
¶ Returns TwiML (Twilio Markup Language) response.
Query Parameters: - text (string) – text to be converted to speech
- media_url (string) – url of mp3 file
Example response:
<?xml version="1.0" encoding="UTF-8"?> <Response> <Say voice="alice">Hello world</Say> <Play>http://example.com/media_file.mp3</Play> </Response>
-
POST
/api/calls
¶ Create a new Twilio call
Request JSON Object: - twilio_account_sid (string) – Twilio API account sid
- twilio_auth_token (string) – Twilio API auth token
- twilio_to_phone (string) – verified phone number to call
- twilio_from_phone (string) – your Twilio phone number
- text (string) – text to be converted to speech
- media_url (string) – url of mp3 file
Example response:
{ "call_id": "CA231fb2e3aba93b69a96178b0848b32d7" }