All URIs are relative to http://localhost
Method | HTTP request | Description |
---|---|---|
DeleteMedia | DELETE /users/{accountId}/media/{mediaId} | Delete Media |
GetMedia | GET /users/{accountId}/media/{mediaId} | Get Media |
ListMedia | GET /users/{accountId}/media | List Media |
UploadMedia | PUT /users/{accountId}/media/{mediaId} | Upload Media |
void DeleteMedia (string accountId, string mediaId)
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.
using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;
namespace Example
{
public class DeleteMediaExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
var mediaId = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve.
try
{
// Delete Media
apiInstance.DeleteMedia(accountId, mediaId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.DeleteMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Delete Media
apiInstance.DeleteMediaWithHttpInfo(accountId, mediaId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.DeleteMediaWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
accountId | string | Your Bandwidth Account ID. | |
mediaId | string | Media ID to retrieve. |
void (empty response body)
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | No Content | - |
400 | Bad Request | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not Found | - |
406 | Not Acceptable | - |
415 | Unsupported Media Type | - |
429 | Too Many Requests | - |
500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
System.IO.Stream GetMedia (string accountId, string mediaId)
Get Media
Downloads a media file you previously uploaded.
using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;
namespace Example
{
public class GetMediaExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
var mediaId = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve.
try
{
// Get Media
System.IO.Stream result = apiInstance.GetMedia(accountId, mediaId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.GetMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get Media
ApiResponse<System.IO.Stream> response = apiInstance.GetMediaWithHttpInfo(accountId, mediaId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.GetMediaWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
accountId | string | Your Bandwidth Account ID. | |
mediaId | string | Media ID to retrieve. |
System.IO.Stream
- Content-Type: Not defined
- Accept: application/octet-stream, application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
400 | Bad Request | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not Found | - |
406 | Not Acceptable | - |
415 | Unsupported Media Type | - |
429 | Too Many Requests | - |
500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<Media> ListMedia (string accountId, string continuationToken = null)
List Media
Gets a list of your media files. No query parameters are supported.
using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;
namespace Example
{
public class ListMediaExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
var continuationToken = 1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39; // string | Continuation token used to retrieve subsequent media. (optional)
try
{
// List Media
List<Media> result = apiInstance.ListMedia(accountId, continuationToken);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.ListMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// List Media
ApiResponse<List<Media>> response = apiInstance.ListMediaWithHttpInfo(accountId, continuationToken);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.ListMediaWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
accountId | string | Your Bandwidth Account ID. | |
continuationToken | string | Continuation token used to retrieve subsequent media. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | * Continuation-Token - Continuation token used to retrieve subsequent media. |
400 | Bad Request | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not Found | - |
406 | Not Acceptable | - |
415 | Unsupported Media Type | - |
429 | Too Many Requests | - |
500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
void UploadMedia (string accountId, string mediaId, System.IO.Stream body, string contentType = null, string cacheControl = null)
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.
using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;
namespace Example
{
public class UploadMediaExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
// Configure HTTP basic authorization: Basic
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
var apiInstance = new MediaApi(config);
var accountId = 9900000; // string | Your Bandwidth Account ID.
var mediaId = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve.
var body = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream |
var contentType = audio/wav; // string | The media type of the entity-body. (optional)
var cacheControl = no-cache; // string | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional)
try
{
// Upload Media
apiInstance.UploadMedia(accountId, mediaId, body, contentType, cacheControl);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.UploadMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Upload Media
apiInstance.UploadMediaWithHttpInfo(accountId, mediaId, body, contentType, cacheControl);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.UploadMediaWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
accountId | string | Your Bandwidth Account ID. | |
mediaId | string | Media ID to retrieve. | |
body | System.IO.Stream****System.IO.Stream | ||
contentType | string | The media type of the entity-body. | [optional] |
cacheControl | string | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] |
void (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
Status code | Description | Response headers |
---|---|---|
204 | No Content | - |
400 | Bad Request | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not Found | - |
406 | Not Acceptable | - |
415 | Unsupported Media Type | - |
429 | Too Many Requests | - |
500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]