Media API

The Media API can be used to query, download and delete media items such as audio files for use with other Nexmo APIs.

OpenAPI-Spezifikation herunterladen

List and search media items

Retrieve the metadata for multiple media items, with the ability to search and paginate.

gethttps://api.nexmo.com/v3/media/

Authentifizierung

Diese API unterstützt sowohl die JWT- als auch die Basis-Authentifizierung. Die Basisauthentifizierung ist einfacher zu handhaben, unterstützt aber keine erweiterten Funktionen wie ACLs.

Sie können entweder JWT oder Basic Authentication verwenden, aber nicht beides gleichzeitig.

SchlüsselBeschreibungWoBeispiel
Authorization

Ihr JSON-Web-Token.
Lesen Sie mehr über JWTs

Headers

Bearer <JWT>
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Abfrage Parameter

order
string
Standarddescending
Beispielascending

The order of search results.

Muss eines der folgenden sein:ascendingdescending
page_index
integer
Beispiel1

Which page to retrieve in pagination

page_size
integer
Standard20
Beispiel50

How many items at most per page

start_time
string
Standard1 week ago
Beispiel2020-01-01T14:00:00.000Z

Retrieve results created on or after this timestap.

end_time
string
Beispiel2020-01-01T14:00:00.000Z

Retrieve results created on or before this timestamp.

Antworten
Inhalt Typ
application/json

Successfully retrieved

page_size
integer
Beispiel20

The amount of records returned in this response.

page_index
integer

The page_index used in your request.

_links
object
self
object
href
string
Beispiel/v3/media?page_size=20&account_id=abcd1234&order=descending
first
object
href
string
Beispiel/v3/media?page_size=20&account_id=abcd1234&order=descending
last
object
href
string
Beispiel/v3/media?page_size=20&account_id=abcd1234&order=descending
count
integer
Beispiel1

The total number of records returned by your request.

_embedded
object

A collection of media items. See retrieve a media item for a description of the returned fields

media
array
id
string
Beispielaaaaaaaa-bbbb-cccc-dddd-0123456789ab

A UUID representing the object.

original_file_name
string
Beispieltest.wav

The filename of the object as it was originally uploaded.

mime_type
string
Beispielaudio/vnd.wave

The IETF MIME type of the file.

account_id
string
Beispielabcd1234

The ID of your Nexmo account. This is the same as your API key.

store_id
string
Beispiels3

An internal identifier of how the file is stored.

max_downloads_allowed
integer

The maximum number of times the file may be downloaded.

times_downloaded
integer
Beispiel1

The number of times the file has been downloaded.

etag
string
Beispielaaaaaaaabbbbccccdddd0123456789ab

An identifier for the content. This will change if the content of the file has been changed (i.e. if you upload a new version of the file). For more information see Wikipedia: HTTP ETag

media_size
integer
Beispiel1234567

The size of the file in bytes

time_created
string
Beispiel2020-01-01T14:00:00.000Z

A timestamp for the time that the file was created

time_last_updated
string
Beispiel2020-01-01T14:00:00.000Z

A timestamp for the time that the file was last modified

public
boolean

Whether the item is available for download without authentication.

metadata_primary
string

A user set string containing metadata about the media file.

metadata_secondary
string

A user set string containing further metadata about the media file.

Beispiel Antwort

{
   "page_size": 20,
   "page_index": 0,
   "_links": {
      "self": {
         "href": "/v3/media?page_size=20&account_id=abcd1234&order=descending"
      },
      "first": {
         "href": "/v3/media?page_size=20&account_id=abcd1234&order=descending"
      },
      "last": {
         "href": "/v3/media?page_size=20&account_id=abcd1234&order=descending"
      }
   },
   "count": 1,
   "_embedded": {
      "media": [
         {
            "id": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
            "original_file_name": "test.wav",
            "mime_type": "audio/vnd.wave",
            "account_id": "abcd1234",
            "store_id": "s3",
            "max_downloads_allowed": 0,
            "times_downloaded": 1,
            "etag": "aaaaaaaabbbbccccdddd0123456789ab",
            "media_size": 1234567,
            "time_created": "2020-01-01T14:00:00.000Z",
            "time_last_updated": "2020-01-01T14:00:00.000Z",
            "public": false,
            "metadata_primary": "string",
            "metadata_secondary": "string"
         }
      ]
   }
}

Retrieve a media item's metadata

Retrieve the metadata for a media item

gethttps://api.nexmo.com/v3/media/:id/info

Authentifizierung

Diese API unterstützt sowohl die JWT- als auch die Basis-Authentifizierung. Die Basisauthentifizierung ist einfacher zu handhaben, unterstützt aber keine erweiterten Funktionen wie ACLs.

Sie können entweder JWT oder Basic Authentication verwenden, aber nicht beides gleichzeitig.

SchlüsselBeschreibungWoBeispiel
Authorization

Ihr JSON-Web-Token.
Lesen Sie mehr über JWTs

Headers

Bearer <JWT>
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Antworten
Inhalt Typ
application/json

Successfully retrieved

id
string
Beispielaaaaaaaa-bbbb-cccc-dddd-0123456789ab

A UUID representing the object.

original_file_name
string
Beispieltest.wav

The filename of the object as it was originally uploaded.

mime_type
string
Beispielaudio/vnd.wave

The IETF MIME type of the file.

account_id
string
Beispielabcd1234

The ID of your Nexmo account. This is the same as your API key.

store_id
string
Beispiels3

An internal identifier of how the file is stored.

max_downloads_allowed
integer

The maximum number of times the file may be downloaded.

times_downloaded
integer
Beispiel1

The number of times the file has been downloaded.

etag
string
Beispielaaaaaaaabbbbccccdddd0123456789ab

An identifier for the content. This will change if the content of the file has been changed (i.e. if you upload a new version of the file). For more information see Wikipedia: HTTP ETag

media_size
integer
Beispiel1234567

The size of the file in bytes

time_created
string
Beispiel2020-01-01T14:00:00.000Z

A timestamp for the time that the file was created

time_last_updated
string
Beispiel2020-01-01T14:00:00.000Z

A timestamp for the time that the file was last modified

public
boolean

Whether the item is available for download without authentication.

metadata_primary
string

A user set string containing metadata about the media file.

metadata_secondary
string

A user set string containing further metadata about the media file.

Beispiel Antwort

{
   "id": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
   "original_file_name": "test.wav",
   "mime_type": "audio/vnd.wave",
   "account_id": "abcd1234",
   "store_id": "s3",
   "max_downloads_allowed": 0,
   "times_downloaded": 1,
   "etag": "aaaaaaaabbbbccccdddd0123456789ab",
   "media_size": 1234567,
   "time_created": "2020-01-01T14:00:00.000Z",
   "time_last_updated": "2020-01-01T14:00:00.000Z",
   "public": false,
   "metadata_primary": "string",
   "metadata_secondary": "string"
}

Update a media item's metadata

Update the metadata of a previously created media item.

puthttps://api.nexmo.com/v3/media/:id/info

Authentifizierung

Diese API unterstützt sowohl die JWT- als auch die Basis-Authentifizierung. Die Basisauthentifizierung ist einfacher zu handhaben, unterstützt aber keine erweiterten Funktionen wie ACLs.

Sie können entweder JWT oder Basic Authentication verwenden, aber nicht beides gleichzeitig.

SchlüsselBeschreibungWoBeispiel
Authorization

Ihr JSON-Web-Token.
Lesen Sie mehr über JWTs

Headers

Bearer <JWT>
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Anfrage Körper
Inhalt Typ
multipart/form-data

public
boolean
Beispieltrue

Whether the item is publicly available without authentication.

metadata_primary
string
Beispielfoo,bar

A string containing metadata about the media file.

metadata_secondary
string
Beispiel123

A string containing further metadata about the media file.

title
string
BeispielVery important recording

A string containing a title for the media file.

description
string
BeispielThis is a very important recording. Do not delete.

A description of the media file.

mime_type
string
Beispielaudio/vnd.wave

The MIME type of the media file.

max_downloads_allowed
integer
Beispiel100

The maximum number of times the file may be downloaded. Unlimited when not provided.

Beispiel Anfrage

POST /v3/media/:id/info HTTP/1.1
Host: api.nexmo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 204

public=true&metadata_primary=foo,bar&metadata_secondary=123&title=Very+important+recording&description=This+is+a+very+important+recording.+Do+not+delete.&mime_type=audio/vnd.wave&max_downloads_allowed=100

Antworten

Successfully updated

Retrieve a media item's content

Download the file associated with a media item

gethttps://api.nexmo.com/v3/media/:id

Authentifizierung

Diese API unterstützt sowohl die JWT- als auch die Basis-Authentifizierung. Die Basisauthentifizierung ist einfacher zu handhaben, unterstützt aber keine erweiterten Funktionen wie ACLs.

Sie können entweder JWT oder Basic Authentication verwenden, aber nicht beides gleichzeitig.

SchlüsselBeschreibungWoBeispiel
Authorization

Ihr JSON-Web-Token.
Lesen Sie mehr über JWTs

Headers

Bearer <JWT>
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Antworten
Inhalt Typ
*/*

Successfully retrieved
The Content-Type header will specify the MIME type of the response body

Beispiel Antwort

Die Beispielvorschau wird derzeit für den Inhaltstyp nicht unterstützt: */*

Delete a media item

Delete a previously created media item by ID.

deletehttps://api.nexmo.com/v3/media/:id

Authentifizierung

Diese API unterstützt sowohl die JWT- als auch die Basis-Authentifizierung. Die Basisauthentifizierung ist einfacher zu handhaben, unterstützt aber keine erweiterten Funktionen wie ACLs.

Sie können entweder JWT oder Basic Authentication verwenden, aber nicht beides gleichzeitig.

SchlüsselBeschreibungWoBeispiel
Authorization

Ihr JSON-Web-Token.
Lesen Sie mehr über JWTs

Headers

Bearer <JWT>
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Antworten

Successfully deleted