Nav

To Search Using the Graph API

The Exchange Graph API lets you search Exchange assets for a string value. You can specify what values to receive in each search.

Because the Graph API accesses Anypoint Exchange and Anypoint Platform, inquiries should have an access token if you want to access assets in private exchange. If you only search for MuleSoft public assets, you don’t need an asset token.

To Obtain an Access Token

You only need an access token if you are searching for assets that are not created by MuleSoft.

Access tokens expire sometime between 15 to 180 minutes (ask your organization administrator), so you may need to get a new token while doing searches.

  1. Log into Anypoint Platform.

  2. Obtain an access token with a curl command such as the following. You can also use Postman or another application for sending HTTP commands.

    
                
             
    1
    2
    3
    4
    5
    6
    7
    
    curl -X POST \
      https://anypoint.mulesoft.com/accounts/login \
      -H 'content-type: application/json' \
      -d '{
      "username": "YOUR_ANYPOINT_PLATFORM_USER_NAME",
      "password": "YOUR_ANYPOINT_PLATFORM_PASSWORD"
    }'

To Search Only a Private Exchange

  1. Get the organization ID for the Private Exchange by clicking an asset in your Private Exchange.

    An example URL is:

    https://anypoint.mulesoft.com/exchange/42424242/product-api/1.0.0/

    42424242 is the organization ID.

  2. Add the organization ID using the organizationIds field.

    A single organization ID would be:

    organizationIds: ["42424242"]

    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    {
      assets(
        query: {
          searchTerm: "product",
          organizationsIds: ["4141141", "32322", "2342345"]
        },
        latestVersionsOnly: true
      ) {
        assetId,
        description
      }
    }

    The output for this example is:

    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    {
      "data": {
        "assets": [
          {
            "assetId": "product-datatype",
            "description": "Product Datatype Asset"
          },
          {
            "assetId": "product-api",
            "description": "Product API Asset"
          }
        ]
      }
    }

Reference: Query Filter Parameters

You can specify filters to display additional information about each asset.

The following filters let you refine query output:

Parameter Description

assetId

Asset ID for each asset.

createdAt

Date and time an asset was created, for example, 2017-08-11T04:48:20.585Z.

createdBy { id, userName, firstName, lastName }

Display who created the asset.

dependencies { groupId, assetId, version, name, type }

Returns the assets the listed asset depends on.

files { classifier, packaging, externalLink, md5 }

File information.

name

Asset name

numberOfRates

The number of star ratings for an asset.

organizationId

Organization ID for an asset.

rating

Star rating value for an asset.

runtimeVersion

Mule Runtime version.

tags { value, key, mutable }

The asset tags. The tags created in the user interface and when publishing are only value tags (they don’t have a key). Tags created in the user interface are mutable while the others are immutable. Tags with a key and value are special tags created by Exchange to describe the asset.

type

Lowercase values corresponding to the Exchange All Types menu: connector, template, example, rest-api, soap-api, raml-fragment, and custom.

version

Version for an asset.

groupId

Group ID for an asset.