REST API‎ > ‎Media Management‎ > ‎

Media Status

This method retrieves status information about the Media ID and the operation in progress, if any, but most importantly the URL and media details.

Method: POST

URI: /api/rest/media/status/{mediaid}

Path parameter: 
  • mediaid  The id of the media to retrieve status for.
Form parameters:
  • appkey  The application key associated with the mediaid.
Returns:
  • OK(200)  Media content (ex. mp3 file) exists for this Media ID.
  • NO_CONTENT(204)  No media content exists for this Media ID.
  • NOT_FOUND(404)  The application key is invalid.
  • UNAUTHORIZED(401)  The media is not related to the specified application.
Response format: JSON

Example using curl

curl -d"appkey=1f1bbca5-b71f-4938-97b6-59fed80623bc" https://api.telesocial.com/api/rest/media/status/6e6a151be31b467f87225b18b0f36f00

Response body: 

{"MediaResponse":
{"message":"","status":200,"downloadUrl":"http:\/\/media.telesocial.com\/audio\/a0\/70\/24\/e2\/1135147210.mp3","fileSize":60603,"mediaId":"6e6a151be31b467f87225b18b0f36f00","uri":"\/api\/rest\/media\/6e6a151be31b467f87225b18b0f36f00"}}


PHP Example

  /**
     * Play media.
     *
     * @param string $mediaID
     * @return bool
     */
    public function getMediaURL($mediaID)
    {
        $query = new telesocialQuery('media/status', $mediaID);
        $query->addApiKey();

        if ($query->make() && $query->response['status'] == 200)
        {
            return $query->response['downloadUrl'];
        }

        return false;
    }