Marketplace/REST

From Eclipsepedia

Jump to: navigation, search

Contents

Eclipse Marketplace REST API Documentation

Provisional API

The Eclipse Marketplace API is currently in a provisional state. The URLs for the API calls may change at any time.

This provisional API is identified by 'api/p' at the end of most URLs.

One of the goals of the API that is to make it very simple for someone to figure out how to use the API by using the website. If you add the /api/p to the websites url it should return the equivalent data in an XML response.


Retrieving a listing of all catalogs

http://marketplace.eclipse.org/catalogs/api/p

This will return a listing of all catalogs that are browsable with the MPC. It also includes basic branding parameters, like title and icon and strategies resolving dependencies. If you want to override this url (e.g. in your RCP application) you have to set the following system-property:

-Dorg.eclipse.epp.internal.mpc.core.service.DefaultCatalogService.url=http://mydomain.tld

This setting will request the url http://mydomain.tld/catalogs/api/p to obtain all available catalogs.


Retrieving A listing of Markets and Categories

http://marketplace.eclipse.org/api/p

This will return a listing of Markets and Categories, it includes URLs for each category, as well number of listings in each category.


Retrieving a set of listings from a specific Market / Category

http://markerplace.eclipse.org/taxonomy/term/[category id],[market id]/api/p

This call returns a set of listings that correspond to the category / market specified.

Example: If you wanted to return the XML for all Build and Deploy Listings in the Tools Market you would use this call.

http://marketplace.eclipse.org/taxonomy/term/4,31/api/p

These urls are easily obtained from using the http://marketplace.eclipse.org/api/p call.

Returning a Specific Listing

There are two methods of returning a specific listing.

http://marketplace.eclipse.org/content/[title]/api/p

and

http://marketplace.eclipse.org/node/[node id]/api/p

Calls to either URL will return a listing of contents of a node.

  • You will need to supply the value in the URL for [title] or [node id]. These URLS will be provided in full by queries to return a subset of listings such as Categories, Searches, Featured etc.
  • Most fields in the XML document are self explanitory. However there are a few fields that require explanation.
  • Type - this is the type of listing being returned. 'training' is for a Training and Consulting Listing, 'resource' is for a solutions listing.
  • Body - this field can and most likely contains HTML markup. This also applies to the Training and Consulting Fields (trainingdesc and consultingdesc)
  • Created - this field is when the listing was first created. It is the number of seconds since the epoch. See http://us.php.net/manual/en/function.time.php for more details.
  • Changed - this field is the last time this listing was changed. It is the number of seconds since the epoch. See http://us.php.net/manual/en/function.time.php for more details.
  • FoundationMember - this is a boolean field. 0 meaning No, 1 meaning Yes.
  • example: http://marketplace.eclipse.org/node/51/api/p will return a Training and Consulting Listing
  • example: http://marketplace.eclipse.org/content/subclipse/api/p will return a Solutions Listing.

Returning Search Results

http://marketplace.eclipse.org/api/p/search/apachesolr_search/[query]?page=[page num]&filters=[filters]

There is one exception to using the api/p at the end of URLs. The search API needs this string to be at the start of the URL.

URL Variables

[query] - This is the string you wish to query the database with

[page num] - The search API returns 10 results per page. Use this parameter to iterate though pages. The root node will always return the total number of results.

[filters] - There are 3 different filters used by the Apache Solr search database that can be used to constrain (Facet) your searches. If you plan to use more then one filter they must be SPACE separated.

  • tid - This field is the database equivalent of category IDs.

Example : http://marketplace.eclipse.org/api/p/search/apachesolr_search/enterprise?filters=tid:9 tid:31 This query would search for 'Enterprise' in the J2EE category of the Tools Market.

  • sm_field_status - this filter is the equivalent of the <status> tag in a listings XML result.

Example : http://marketplace.eclipse.org/api/p/search/apachesolr_search/enterprise?filters=sm_field_status:Production%2FStable This query would search for 'Enterprise' listings that have a Status matching 'Production/Stable'

  • sm_field_licensetype - this filter is the equivalent of the <license> tag in the listings XML result.

Example : http://marketplace.eclipse.org/api/p/search/apachesolr_search/enterprise?filters=sm_field_licensetype:Free EPL' This query would search for 'Enterprise' listings that have a License Type matching "Free EPL".

Featured Listings

http://marketplace.eclipse.org/featured/api/p

This call will return a list of Featured Listings. By default this returns 6 listings. The default is configured on the server.


http://marketplace.eclipse.org/featured/%/api/p

This call will return a list of featured listings constrained by a category / market id (or both). By default this returns 6 listings. The default is configured on the server.

Example:


Recently Updated Listings

http://marketplace.eclipse.org/recent/api/p

This call will return a list of Recently Updated or Added Listings. By default this returns 6 listings. The default is configured on the server.


Top Favorited Listings

http://marketplace.eclipse.org/favorites/top/api/p

This call will return a list of the Most Favorited Listings. By default this returns 6 listings. The default is configured on the server.


Most Popular Listings

http://marketplace.eclipse.org/popular/top/api/p

This call will return a list of Most Popular listing by activity. By default this returns 6 listings. The default is configured on the server.


URL Variables

[client] - The only valid value for the client variable is "org.eclipse.epp.mpc.core". This variable is usually sent from MPC to alter the default list. It's available for the Most Popular Listings, Top Favorited Listings, Recently Updated Listings and Featured Listings. Only installable listings owned by an Eclipse member company will be returned.

Featured Listings : If available, it can insert up-to two promoted downloads at the top of the list. It is possible to see a commercial listing here.

Recently Updated Listings, Top Favorited Listings & Most Popular Listings: Only returns listings that don't have a commercial license.

Example: http://marketplace.eclipse.org/featured/api/p?client=org.eclipse.epp.mpc.core

Catalogs

What is a Catalog

A catalog is an HTTP service which returns XML data back to the Marketplace Client from. Currently Marketplace uses PHP with an SQL backend to serve these pages to the MPC.

Building a Catalog

In terms of building your own catalog with this data you would follow a three step process.

  1. Query the Base URL for a listing of Markets and their categories.
  2. Iterate through that query to retrieve listings for each category using the Category URL.
  3. Finally iterate through the Category Query to retrieve the data related to each node.

News Page

For MPC Kepler, it's going to be possible to add an additional tab containing an embedded browser component that shows a news page. The page URL to display will be included in the marketplace catalog description pulled from the server. It's possible to override a catalog default URL with news/api/p.

Here's an example of the default Eclipse Marketplace catalog news page: http://marketplace.eclipse.org/news/api/p

Marketplace Client

The Marketplace Client (MPC) project implements a client to the REST API. Though the client does not provide public Java API for accessing the REST API, it may be useful for testing purposes when building a catalog.

Of interest to catalog providers or implementors of client libraries to access the REST API in MPC:

  • /org.eclipse.epp.mpc.core/mpc-rest.xsd An XML Schema that describes the REST API data format
  • org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService A Java class that provides a Java API to the REST service
  • org.eclipse.epp.mpc.tests.service.DefaultMarketplaceServiceTest A JUnit test case that exercises the REST API