REST API‎ > ‎Media Management‎ > ‎

Create Media

This method returns a Media ID that can be used with subsequent method calls that accept mediaid parameters.

Method: POST
URI: /api/rest/media

Form parameters:
  • appkey  The application key to associate with the Media ID.
  • CREATED(201)  The Media ID was successfully created.
  • BAD_REQUEST(400)  Missing parameter(s).
  • NOT_FOUND(404)  The application key is invalid.
Response format: JSON

Example using curl

curl -d "appkey=1f1bbc2a5-b71f-4938-97b6-59fed803623bc"

Response body:


PHP Examples

In the example code below a mediaID is generated and fed to the "Record" function...

 public function createMedia($networkID, $greetingID = '380b6123ae9a65948a2988667b35f0ae71d')
        $query = new telesocialQuery('media');

        if ($query->make() && $query->response['status'] == 201)
            //Getting media ID
            $mediaID = $query->response['mediaId'];

            $query = new telesocialQuery('media', $mediaID);
            $query->add('networkid', $networkID);
            $query->add('action', 'record');
            if ($greetingID)
                $query->add('greetingid', $greetingID);

            if ($query->make() && $query->response['status'] == 202)
                return $mediaID;

        return false;