Chilkat Online Tools

Android / Salesforce Platform APIs / GetPBE (Single Selling Model)

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;

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateString("q","Select ID, Name, ProductSellingModel.Name from pricebookentry where Product2.Name IN ('Classroom Training', 'SLA_Bronze','Work Anywhere Software Bundle') order by name ASC");

    // Adds the "Authorization: Bearer <access_token>" header.
    http.put_AuthToken("<access_token>");

    CkHttpResponse resp = http.QuickRequestParams("GET","https://domain.com/services/data/v{{version}}/query",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 "q=Select%20ID,%20Name,%20ProductSellingModel.Name%20from%20pricebookentry%20where%20Product2.Name%20IN%20%28%27Classroom%20Training%27,%20%27SLA_Bronze%27,%27Work%20Anywhere%20Software%20Bundle%27%29%20order%20by%20name%20ASC"
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/query

Postman Collection Item JSON

{
  "name": "GetPBE (Single Selling Model)",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          "const context = pm.environment.name ? pm.environment : pm.collectionVariables;",
          "const jsonData = JSON.parse(responseBody);",
          "",
          "context.set(\"ClassTrainingOneTimePBE\", jsonData.records[0].Id);",
          "context.set(\"SLABronzeEvergrnMonthPBE\", jsonData.records[1].Id);",
          "context.set(\"WorkAnywhereBundlePBE\", jsonData.records[2].Id);",
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/query?q=Select ID, Name, ProductSellingModel.Name from pricebookentry where Product2.Name IN ('Classroom Training', 'SLA_Bronze','Work Anywhere Software Bundle') order by name ASC",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "query"
      ],
      "query": [
        {
          "key": "q",
          "value": "Select ID, Name, ProductSellingModel.Name from pricebookentry where Product2.Name IN ('Classroom Training', 'SLA_Bronze','Work Anywhere Software Bundle') order by name ASC"
        }
      ]
    }
  },
  "response": [
  ]
}