Chilkat Online Tools

Android / Anypoint Platform APIs / Get all assets for organization shared with me

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("search","");
    queryParams.UpdateString("types","api-group");
    queryParams.UpdateString("types","connector");
    queryParams.UpdateString("types","custom");
    queryParams.UpdateString("types","example");
    queryParams.UpdateString("types","extension");
    queryParams.UpdateString("types","http-api");
    queryParams.UpdateString("types","policy");
    queryParams.UpdateString("types","raml-fragment");
    queryParams.UpdateString("types","rest-api");
    queryParams.UpdateString("types","soap-api");
    queryParams.UpdateString("types","template");
    queryParams.UpdateString("domain","");
    queryParams.UpdateString("organizationId","{{mulesoft_org_id}}");
    queryParams.UpdateString("masterOrganizationId","");
    queryParams.UpdateInt("offset",0);
    queryParams.UpdateInt("limit",20);
    queryParams.UpdateString("sharedWithMe","true");
    queryParams.UpdateString("includeSnapshots","true");

    // Adds the "Authorization: Bearer {{token}}" header.
    http.put_AuthToken("{{token}}");

    CkHttpResponse resp = http.QuickRequestParams("GET","https://domain.com/exchange/api/v2/assets",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 "search="
	-d "types=api-group"
	-d "types=connector"
	-d "types=custom"
	-d "types=example"
	-d "types=extension"
	-d "types=http-api"
	-d "types=policy"
	-d "types=raml-fragment"
	-d "types=rest-api"
	-d "types=soap-api"
	-d "types=template"
	-d "domain="
	-d "organizationId=%7B%7Bmulesoft_org_id%7D%7D"
	-d "masterOrganizationId="
	-d "offset=0"
	-d "limit=20"
	-d "sharedWithMe=true"
	-d "includeSnapshots=true"
	-H "Authorization: Bearer {{token}}"
https://domain.com/exchange/api/v2/assets

Postman Collection Item JSON

{
  "name": "Get all assets for organization shared with me",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{token}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/exchange/api/v2/assets?search=&types=api-group&types=connector&types=custom&types=example&types=extension&types=http-api&types=policy&types=raml-fragment&types=rest-api&types=soap-api&types=template&domain=&organizationId={{mulesoft_org_id}}&masterOrganizationId=&offset=0&limit=20&sharedWithMe=true&includeSnapshots=true",
      "host": [
        "{{url}}"
      ],
      "path": [
        "exchange",
        "api",
        "v2",
        "assets"
      ],
      "query": [
        {
          "key": "search",
          "value": ""
        },
        {
          "key": "types",
          "value": "api-group"
        },
        {
          "key": "types",
          "value": "connector"
        },
        {
          "key": "types",
          "value": "custom"
        },
        {
          "key": "types",
          "value": "example"
        },
        {
          "key": "types",
          "value": "extension"
        },
        {
          "key": "types",
          "value": "http-api"
        },
        {
          "key": "types",
          "value": "policy"
        },
        {
          "key": "types",
          "value": "raml-fragment"
        },
        {
          "key": "types",
          "value": "rest-api"
        },
        {
          "key": "types",
          "value": "soap-api"
        },
        {
          "key": "types",
          "value": "template"
        },
        {
          "key": "domain",
          "value": ""
        },
        {
          "key": "organizationId",
          "value": "{{mulesoft_org_id}}"
        },
        {
          "key": "masterOrganizationId",
          "value": ""
        },
        {
          "key": "offset",
          "value": "0"
        },
        {
          "key": "limit",
          "value": "20"
        },
        {
          "key": "sharedWithMe",
          "value": "true"
        },
        {
          "key": "includeSnapshots",
          "value": "true"
        }
      ]
    }
  },
  "response": [
  ]
}