All URIs are relative to http://localhost
Method | HTTP request | Description |
---|---|---|
delete_media | DELETE /users/{accountId}/media/{mediaId} | Delete Media |
get_media | GET /users/{accountId}/media/{mediaId} | Get Media |
list_media | GET /users/{accountId}/media | List Media |
upload_media | PUT /users/{accountId}/media/{mediaId} | Upload Media |
delete_media(account_id, media_id)
Delete Media
Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name.
require 'time'
require 'bandwidth-sdk'
# setup authorization
Bandwidth.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Bandwidth::MediaApi.new
account_id = '9900000' # String | Your Bandwidth Account ID.
media_id = '14762070468292kw2fuqty55yp2b2/0/bw.png' # String | Media ID to retrieve.
begin
# Delete Media
api_instance.delete_media(account_id, media_id)
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->delete_media: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> delete_media_with_http_info(account_id, media_id)
begin
# Delete Media
data, status_code, headers = api_instance.delete_media_with_http_info(account_id, media_id)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->delete_media_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
account_id | String | Your Bandwidth Account ID. | |
media_id | String | Media ID to retrieve. |
nil (empty response body)
- Content-Type: Not defined
- Accept: application/json
File get_media(account_id, media_id)
Get Media
Downloads a media file you previously uploaded.
require 'time'
require 'bandwidth-sdk'
# setup authorization
Bandwidth.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Bandwidth::MediaApi.new
account_id = '9900000' # String | Your Bandwidth Account ID.
media_id = '14762070468292kw2fuqty55yp2b2/0/bw.png' # String | Media ID to retrieve.
begin
# Get Media
result = api_instance.get_media(account_id, media_id)
p result
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->get_media: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(File, Integer, Hash)> get_media_with_http_info(account_id, media_id)
begin
# Get Media
data, status_code, headers = api_instance.get_media_with_http_info(account_id, media_id)
p status_code # => 2xx
p headers # => { ... }
p data # => File
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->get_media_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
account_id | String | Your Bandwidth Account ID. | |
media_id | String | Media ID to retrieve. |
File
- Content-Type: Not defined
- Accept: application/octet-stream, application/json
<Array> list_media(account_id, opts)
List Media
Gets a list of your media files. No query parameters are supported.
require 'time'
require 'bandwidth-sdk'
# setup authorization
Bandwidth.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Bandwidth::MediaApi.new
account_id = '9900000' # String | Your Bandwidth Account ID.
opts = {
continuation_token: '1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39' # String | Continuation token used to retrieve subsequent media.
}
begin
# List Media
result = api_instance.list_media(account_id, opts)
p result
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->list_media: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(<Array>, Integer, Hash)> list_media_with_http_info(account_id, opts)
begin
# List Media
data, status_code, headers = api_instance.list_media_with_http_info(account_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Array<Media>>
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->list_media_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
account_id | String | Your Bandwidth Account ID. | |
continuation_token | String | Continuation token used to retrieve subsequent media. | [optional] |
- Content-Type: Not defined
- Accept: application/json
upload_media(account_id, media_id, body, opts)
Upload Media
Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found here.
require 'time'
require 'bandwidth-sdk'
# setup authorization
Bandwidth.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Bandwidth::MediaApi.new
account_id = '9900000' # String | Your Bandwidth Account ID.
media_id = '14762070468292kw2fuqty55yp2b2/0/bw.png' # String | Media ID to retrieve.
body = File.new('/path/to/some/file') # File |
opts = {
content_type: 'audio/wav', # String | The media type of the entity-body.
cache_control: 'no-cache' # String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.
}
begin
# Upload Media
api_instance.upload_media(account_id, media_id, body, opts)
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->upload_media: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> upload_media_with_http_info(account_id, media_id, body, opts)
begin
# Upload Media
data, status_code, headers = api_instance.upload_media_with_http_info(account_id, media_id, body, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue Bandwidth::ApiError => e
puts "Error when calling MediaApi->upload_media_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
account_id | String | Your Bandwidth Account ID. | |
media_id | String | Media ID to retrieve. | |
body | File | ||
content_type | String | The media type of the entity-body. | [optional] |
cache_control | String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] |
nil (empty response body)
- Content-Type: application/json, application/ogg, application/pdf, application/rtf, application/zip, application/x-tar, application/xml, application/gzip, application/x-bzip2, application/x-gzip, application/smil, application/javascript, audio/mp4, audio/mpeg, audio/ogg, audio/flac, audio/webm, audio/wav, audio/amr, audio/3gpp, image/bmp, image/gif, image/jpeg, image/pjpeg, image/png, image/svg+xml, image/tiff, image/webp, image/x-icon, text/css, text/csv, text/calendar, text/plain, text/javascript, text/vcard, text/vnd.wap.wml, text/xml, video/avi, video/mp4, video/mpeg, video/ogg, video/quicktime, video/webm, video/x-ms-wmv
- Accept: application/json