Chilkat Online Tools

Node.js / Plivo REST API / List MMS Media

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

    http.BasicAuth = true;
    http.Login = "{{auth_id}}";
    http.Password = "password";

    var sbResponseBody = new chilkat.StringBuilder();
    success = http.QuickGetSb("https://api.plivo.com/v1/Account/<auth_id>/Message/{message_uuid}/Media/",sbResponseBody);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log("Response status code = " + http.LastStatus);
    console.log(sbResponseBody.GetAsString());

}

chilkatExample();

Curl Command

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

Postman Collection Item JSON

{
  "name": "List MMS Media",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Message/{message_uuid}/Media/",
      "protocol": "https",
      "host": [
        "api",
        "plivo",
        "com"
      ],
      "path": [
        "v1",
        "Account",
        "{{auth_id}}",
        "Message",
        "{message_uuid}",
        "Media",
        ""
      ]
    },
    "description": "Lists the media files sent or received with an MMS message.More information can be found [here](https://www.plivo.com/docs/sms/api/message#list-mms-media)"
  },
  "response": [
    {
      "name": "List MMS Media",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Message/{message_uuid}/Media/",
          "protocol": "https",
          "host": [
            "api",
            "plivo",
            "com"
          ],
          "path": [
            "v1",
            "Account",
            "{{auth_id}}",
            "Message",
            "{message_uuid}",
            "Media",
            ""
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": [
      ],
      "cookie": [
      ],
      "body": "{\n    \"api_id\": \"035eeada-6df1-11e6-b608-06a72a185e87\",\n    \"objects\": [\n        {\n            \"content_type\": \"application/pdf\",\n            \"media_id\": \"0178eb8a-461a-4fd1-bc37-13eebfdc0676\",\n            \"media_url\": \"https://media.plivo.com/Account/{auth_id}/Message/24d742b9-9b12-4397-93a7-da496bc874d9/Media/0178eb8a-461a-4fd1-bc37-13eebfdc0676\",\n            \"message_uuid\": \"24d742b9-9b12-4397-93a7-da496bc874d9\",\n            \"size\": 433994\n        }\n    ]\n}"
    }
  ]
}