This documentation is for WSO2 ES version 2.0.0. View documentation for the latest release.
Sort All Assets via the Publisher REST API - Enterprise Store 2.0.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

Overview

DescriptionSort all assets that correspond to a specific asset type.
Resource Path

/assets?type={asset_type}&sort=+{attribute_1},-{attribute_2}

URL

/publisher/apis/assets?type={asset_type}&sort=+{attribute_1},-{attribute_2}

HTTP MethodGET

Request

 

curl -k -H "Accept: {Accept_header}" -X GET "https://<ES_HOST>:<ES_HTTPS_PORT>/publisher/apis/assets?type={asset_type}&sort=+{attribute_1},-{attribute_2}" -b 'JSESSIONID={sessionId}' -v
  • {Accept_header} - If the accept header is not specified, the default accept header is applied, which is application/json. If you send an unsupported accept header along with the request, you will receive the 406 error status code in the response.

  • <ES_HOST> - By default, the host is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.

  • <ES_HTTPS_PORT> - By default, the port is set to 9443. However, if port offset has been incremented by n, the default port value too needs to be incremented by n.

  • {asset_type} - Any default or custom asset type (e.g., gadget, site, soapservice etc.) that is available in ES. All asset types need to have a valid RXT definition.

  • sort - Any attribute corresponding to the asset type can be specified. The unary operators (+ -) indicate the ascending and descending patterns.
  • {sessionId} - Add the generated session ID. For more information on how to generate a session ID, see Authenticate Credentials via the Publisher REST API.

For example:

Example1
curl -k -H "Accept: application/json" -X GET "https://localhost:9443/publisher/apis/assets?type=gadget&sort=+overview_name" -b 'JSESSIONID=E103647A8FDA32E5ABD15CBBAB5E6F72' -v
  • In the above example, the results of the API call are sorted by the overview_name field of the resource being returned.

  • The result is ordered by the ascending order of the overview_name.
     
Example 2
curl -k -H "Accept: application/json" -X GET "https://localhost:9443/publisher/apis/assets?type=gadget&sort=+overview_name,-overview_provider" -b 'JSESSIONID=E103647A8FDA32E5ABD15CBBAB5E6F72' -v
  • In the above example, the results of the API call are sorted by the overview_name and overview_provider fields of the resource being returned.

  • The result is ordered by the ascending order of the overview_name and descending order of the overview_provider.
> GET /publisher/apis/assets?type=gadget&sort=+overview_name HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5
> Host: localhost:9443
> Cookie: JSESSIONID=E103647A8FDA32E5ABD15CBBAB5E6F72
> Accept: application/json
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Mon, 22 Jun 2015 05:50:13 GMT
< Server: WSO2 Carbon Server
< 
{"count":3,"list":[{"id":"47ce9df1-133b-4ada-bc47-db5618d32ce7","type":"gadget","path":"\/_system\/governance\/gadgets\/admin\/Bar Chart\/1.0.0","lifecycle":"SampleLifeCycle2","lifecycleState":"Published","mediaType":"application\/vnd.wso2-gadget+xml","attributes":{"overview_location":"\/config\/defaults\/gadgets\/bar-chart","overview_description":"A generic Bar Chart gadget, that takes a json datasource as an input. It can be configured to fetch data in defined intervals. This gadget can be used to create dashboards with statistical data. This gadget can be reused as an iframe in any web page as it is self contained.","overview_dataformat":"\/config\/defaults\/gadgets\/bar-chart\/datasource\/data-format.json","overview_name":"Bar Chart","overview_version":"1.0.0","overview_url":"http:\/\/192.168.122.1:9763\/publisher\/samples\/assets\/gadgets\/\/bar-chart\/bar-chart.xml","overview_provider":"admin","images_banner":"images_banner","overview_chartoptions":"\/config\/defaults\/gadgets\/bar-chart\/config\/chart-options.json","overview_createdtime":"00000001438768409894","overview_category":"Google","images_thumbnail":"images_thumbnail"},"content":{},"name":"Bar Chart","thumbnail":"images_thumbnail","banner":"images_banner","rating":0,"version":"1.0.0","_default":true},{"id":"f742081b-5310-4411-bf96-7cb6382d55cf","type":"gadget","path":"\/_system\/governance\/gadgets\/admin\/Bubble Chart\/1.0.0","lifecycle":"SampleLifeCycle2","lifecycleState":"Published","mediaType":"application\/vnd.wso2-gadget+xml","attributes":{"overview_location":"\/config\/defaults\/gadgets\/bubble-chart","overview_description":"A generic Bubble Chart gadget, that takes a json datasource as an input. It can be configured to fetch data in defined intervals. This gadget can be used to create dashboards with statistical data. This gadget can be reused as an iframe in any web page as it is self contained","overview_dataformat":"\/config\/defaults\/gadgets\/bubble-chart\/datasource\/data-format.json","overview_name":"Bubble Chart","overview_version":"1.0.0","overview_url":"http:\/\/192.168.122.1:9763\/publisher\/samples\/assets\/gadgets\/\/bubble-chart\/bubble-chart.xml","overview_provider":"admin","images_banner":"images_banner","overview_chartoptions":"\/config\/defaults\/gadgets\/bubble-chart\/config\/chart-options.json","overview_createdtime":"00000001438768410012","overview_category":"Google","images_thumbnail":"images_thumbnail"},"content":{},"name":"Bubble Chart","thumbnail":"images_thumbnail","banner":"images_banner","rating":0,"version":"1.0.0","_default":true},{"id":"8c9cb161-883e-4e70-b584-11179d07cf3f","type":"gadget","path":"\/_system\/governance\/gadgets\/admin\/Horizontal Bar Chart\/1.0.0","lifecycle":"SampleLifeCycle2","lifecycleState":"Published","mediaType":"application\/vnd.wso2-gadget+xml","attributes":{"overview_location":"\/config\/defaults\/gadgets\/horizontal-bar-chart","overview_description":"A generic Horizontal Bar Chart gadget, that takes a json datasource as an input. It can be configured to fetch data in defined intervals. This gadget can be used to create dashboards with statistical data. This gadget can be reused as an iframe in any web page as it is self contained","overview_dataformat":"\/config\/defaults\/gadgets\/horizontal-bar-chart\/datasource\/data-format.json","overview_name":"Horizontal Bar Chart","overview_version":"1.0.0","overview_url":"http:\/\/192.168.122.1:9763\/publisher\/samples\/assets\/gadgets\/\/horizontal-bar-chart\/horizontal-bar-chart.xml","overview_provider":"admin","images_banner":"images_banner","overview_chartoptions":"\/config\/defaults\/gadgets\/horizontal-bar-chart\/config\/chart-options.json","overview_createdtime":"00000001438768410256","overview_category":"Templates","images_thumbnail":"images_thumbnail"},"content":{},"name":"Horizontal Bar Chart","thumbnail":"images_thumbnail","banner":"images_banner","rating":0,"version":"1.0.0","_default":true}]}

Response 

Sample response

{  
   "count":3,
   "list":[  
      {  
         "id":"47ce9df1-133b-4ada-bc47-db5618d32ce7",
         "type":"gadget",
         "path":"\/_system\/governance\/gadgets\/admin\/Bar Chart\/1.0.0",
         "lifecycle":"SampleLifeCycle2",
         "lifecycleState":"Published",
         "mediaType":"application\/vnd.wso2-gadget+xml",
         "attributes":{  
            "overview_location":"\/config\/defaults\/gadgets\/bar-chart",
            "overview_description":"A generic Bar Chart gadget, that takes a json datasource as an input. It can be configured to fetch data in defined intervals. This gadget can be used to create dashboards with statistical data. This gadget can be reused as an iframe in any web page as it is self contained.",
            "overview_dataformat":"\/config\/defaults\/gadgets\/bar-chart\/datasource\/data-format.json",
            "overview_name":"Bar Chart",
            "overview_version":"1.0.0",
            "overview_url":"http:\/\/192.168.122.1:9763\/publisher\/samples\/assets\/gadgets\/\/bar-chart\/bar-chart.xml",
            "overview_provider":"admin",
            "images_banner":"images_banner",
            "overview_chartoptions":"\/config\/defaults\/gadgets\/bar-chart\/config\/chart-options.json",
            "overview_createdtime":"00000001438768409894",
            "overview_category":"Google",
            "images_thumbnail":"images_thumbnail"
         },
         "content":{  

         },
         "name":"Bar Chart",
         "thumbnail":"images_thumbnail",
         "banner":"images_banner",
         "rating":0,
         "version":"1.0.0",
         "_default":true
      },
      {  
         "id":"f742081b-5310-4411-bf96-7cb6382d55cf",
         "type":"gadget",
         "path":"\/_system\/governance\/gadgets\/admin\/Bubble Chart\/1.0.0",
         "lifecycle":"SampleLifeCycle2",
         "lifecycleState":"Published",
         "mediaType":"application\/vnd.wso2-gadget+xml",
         "attributes":{  
            "overview_location":"\/config\/defaults\/gadgets\/bubble-chart",
            "overview_description":"A generic Bubble Chart gadget, that takes a json datasource as an input. It can be configured to fetch data in defined intervals. This gadget can be used to create dashboards with statistical data. This gadget can be reused as an iframe in any web page as it is self contained",
            "overview_dataformat":"\/config\/defaults\/gadgets\/bubble-chart\/datasource\/data-format.json",
            "overview_name":"Bubble Chart",
            "overview_version":"1.0.0",
            "overview_url":"http:\/\/192.168.122.1:9763\/publisher\/samples\/assets\/gadgets\/\/bubble-chart\/bubble-chart.xml",
            "overview_provider":"admin",
            "images_banner":"images_banner",
            "overview_chartoptions":"\/config\/defaults\/gadgets\/bubble-chart\/config\/chart-options.json",
            "overview_createdtime":"00000001438768410012",
            "overview_category":"Google",
            "images_thumbnail":"images_thumbnail"
         },
         "content":{  

         },
         "name":"Bubble Chart",
         "thumbnail":"images_thumbnail",
         "banner":"images_banner",
         "rating":0,
         "version":"1.0.0",
         "_default":true
      },
      {  
         "id":"8c9cb161-883e-4e70-b584-11179d07cf3f",
         "type":"gadget",
         "path":"\/_system\/governance\/gadgets\/admin\/Horizontal Bar Chart\/1.0.0",
         "lifecycle":"SampleLifeCycle2",
         "lifecycleState":"Published",
         "mediaType":"application\/vnd.wso2-gadget+xml",
         "attributes":{  
            "overview_location":"\/config\/defaults\/gadgets\/horizontal-bar-chart",
            "overview_description":"A generic Horizontal Bar Chart gadget, that takes a json datasource as an input. It can be configured to fetch data in defined intervals. This gadget can be used to create dashboards with statistical data. This gadget can be reused as an iframe in any web page as it is self contained",
            "overview_dataformat":"\/config\/defaults\/gadgets\/horizontal-bar-chart\/datasource\/data-format.json",
            "overview_name":"Horizontal Bar Chart",
            "overview_version":"1.0.0",
            "overview_url":"http:\/\/192.168.122.1:9763\/publisher\/samples\/assets\/gadgets\/\/horizontal-bar-chart\/horizontal-bar-chart.xml",
            "overview_provider":"admin",
            "images_banner":"images_banner",
            "overview_chartoptions":"\/config\/defaults\/gadgets\/horizontal-bar-chart\/config\/chart-options.json",
            "overview_createdtime":"00000001438768410256",
            "overview_category":"Templates",
            "images_thumbnail":"images_thumbnail"
         },
         "content":{  

         },
         "name":"Horizontal Bar Chart",
         "thumbnail":"images_thumbnail",
         "banner":"images_banner",
         "rating":0,
         "version":"1.0.0",
         "_default":true
      }
   ]
}
  • count - Is the number of assets retrieved.
  • list - This section lists out the assets that are retrieved.

For information on all the properties in the assets definition, see the Asset Resource Definition.

HTTP status codes

ResponseHTTP Status Codes
Success

200

Error400, 401, 406, 500, 501

For more information on the status codes, see HTTP Status Codes.

  • No labels