Chilkat Online Tools

Android / Plivo REST API / Retrieve a PHLO

Back to Collection Items

// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    CkHttp http = new CkHttp();
    boolean success;

    http.put_BasicAuth(true);
    http.put_Login("{{auth_id}}");
    http.put_Password("password");

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateString("phlo_id","<PHLO_ID>");

    CkHttpResponse resp = http.QuickRequestParams("GET","https://phlorunner.plivo.com/v1/phlo/{phlo_id}",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());
        return;
        }

    Log.i(TAG, String.valueOf(resp.get_StatusCode()));
    Log.i(TAG, resp.bodyStr());


  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}

Curl Command

curl -G -d "phlo_id=%3CPHLO_ID%3E"
	-u '{{auth_id}}:password'
https://phlorunner.plivo.com/v1/phlo/{phlo_id}

Postman Collection Item JSON

{
  "name": "Retrieve a PHLO",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://phlorunner.plivo.com/v1/phlo/{phlo_id}?phlo_id=<PHLO_ID>",
      "protocol": "https",
      "host": [
        "phlorunner",
        "plivo",
        "com"
      ],
      "path": [
        "v1",
        "phlo",
        "{phlo_id}"
      ],
      "query": [
        {
          "key": "phlo_id",
          "value": "<PHLO_ID>",
          "description": "Unique identifier for the PHLO. PHLO ID is available on your\nconsole."
        }
      ]
    },
    "description": "More information can be found [here](https://www.plivo.com/docs/phlo/api/phlo#retrieve-a-phlo)"
  },
  "response": [
    {
      "name": "Retrieve a PHLO",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "https://phlorunner.plivo.com/v1/phlo/{phlo_id}?phlo_id=<PHLO_ID>",
          "protocol": "https",
          "host": [
            "phlorunner",
            "plivo",
            "com"
          ],
          "path": [
            "v1",
            "phlo",
            "{phlo_id}"
          ],
          "query": [
            {
              "key": "phlo_id",
              "value": "<PHLO_ID>",
              "description": "Unique identifier for the PHLO. PHLO ID is available on your\nconsole."
            }
          ]
        }
      },
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
      ],
      "cookie": [
      ],
      "body": "{\n    \"api_id\": \"e4202a42-0419-43db-9889-c440d3167796\",\n    \"phlo_id\": \"4c1a9f23-7f56-4879-bb80-db856e1e7701\",\n    \"name\": \"SMS Notifications\",\n    \"created_on\": \"2019-01-30 09:20:08.617883+00:00\"\n}"
    }
  ]
}