Chilkat Online Tools

autoit / Plivo REST API / Retrieve Media

Back to Collection Items

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oHttp.BasicAuth = True
$oHttp.Login = "{{auth_id}}"
$oHttp.Password = "password"

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://api.plivo.com/v1/Account/<auth_id>/Media/{media_id}/",$oSbResponseBody)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("Response status code = " & $oHttp.LastStatus & @CRLF)
ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF)

Curl Command

curl -X GET
	-u '{{auth_id}}:password'
https://api.plivo.com/v1/Account/<auth_id>/Media/{media_id}/

Postman Collection Item JSON

{
  "name": "Retrieve Media",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Media/{media_id}/",
      "protocol": "https",
      "host": [
        "api",
        "plivo",
        "com"
      ],
      "path": [
        "v1",
        "Account",
        "{{auth_id}}",
        "Media",
        "{media_id}",
        ""
      ]
    },
    "description": "This API lets you retrieve a media file uploaded, sent or received by the user. More information can be found [here](https://www.plivo.com/docs/sms/api/media#retrieve-media)"
  },
  "response": [
    {
      "name": "Retrieve Media",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Media/{media_id}/",
          "protocol": "https",
          "host": [
            "api",
            "plivo",
            "com"
          ],
          "path": [
            "v1",
            "Account",
            "{{auth_id}}",
            "Media",
            "{media_id}",
            ""
          ]
        }
      },
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
      ],
      "cookie": [
      ],
      "body": "{\n    \"api_id\": \"<api_id>\",\n    \"content_type\": \"image/png\",\n    \"file_name\": \"SampleFile.png\",\n    \"media_id\": \"<media_id>\",\n    \"size\": 700670,\n    \"upload_time\": \"2020-02-17T07:53:36.643522Z\",\n    \"media_url\": \"https://media.plivo.com/Account/<auth_id>/Media/<media_id>\"\n}"
    }
  ]
}