Project

General

Profile

Actions

CdmRestServices2 » History » Revision 14

« Previous | Revision 14/65 (diff) | Next »
Andreas Kohlbecker, 07/21/2009 09:45 AM


CDM REST Services 2.0

The CDM REST Services are a web based interface to resources stored in a CDM Community Server. The RESTful architecture allows accessing the various resources like Taxa, Names, References, Media, etc by stable URIs. Due to security constraints and to assure the integration of data, currently only read operations (= HTTP GET) are permitted, write operations will be available in the near future.

In contrast to the former CDM REST Services 1.0 the new architecture directly exposes domain model entities. Whereas the version 1.0 still was build using the DTO/Assembler pattern the new implementation provides direct serializations of the objects as they are stored in the CDM. Now there is no longer a difference between the data model used to store and manage CDM objects and another one used to transfer them to web based clients. Thereby it has become much easier to use the web service.

Object Boundaries

The ...

Content Negotiation

There are two ways to demand a special content type:

  1. by file extension (*.json or *.xml)

  2. by Accept HTTP request header #sec14.1 - Accepted mime types are: application/json@, @text/xml

  3. Default: XML

The CDM REST Services 2.0 primarily trys using the file extension, then the Accept HTTP request header is taken into account. If whether the file extension or not the Accept HTTP request header specify valid content types the default XML will be used.

Developer Hints

Classes involved in Content Negotiation:

Configuration in:

Localization

I order to provide the client with localized resources some services respect the Accept-Language HTTP header #sec14.4.

For example the Portal service returns localized representations according to the Language tags supplied in the Accept-Language HTTP header. For each single CDM entity having language dependent representation (see: source:trunk/cdmlib/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/model/common/Representation.java or source:trunk/cdmlib/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/model/common/MultilanguageText.java)

the service tries finding the best matching representation. If no representation in any preferred language is found the service falls back to return the representation in source:trunk/cdmlib/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/Language.java#L126 and if necessary further falls back to return the first representation found if any exists.

Please see below for detailed information on how and whether localization is handled by the different service sections.

Developer Hints

Classes involved in Content Negotiation:

Configuration in:

  • -- not necessary --

Character Encoding

All data is returned in UTF-8 character encoding.

Service Sections

The CDM REST Services architecture is functionally separated into tree different parts:

  • the API Service a clean RESTful bit, which will expose data in a modular, normalized way. It is a more-or-less one-to-one concordance between URIs and service api methods.

  • the Portal Service which is specially taliored for the needs of dataportals which will primarily display "Species Page". Thus this service will be provide denormalized pages which contain a specific assemblys of information.

  • the External Service services supporting non CDM application and services like for example a map generation service.

API REST service

e.g.

taxonService.get(UUID uuid)

and

GET /taxon/{uuid}

Following from that logic, the listing methods should work thus

taxonService.list(Class<? extends TaxonBase> clazz, Integer page, Integer limit, etc)

and the URI would be

GET /taxon?page=X&limit=Y&clazz=Z

Portal REST Service

Updated by Andreas Kohlbecker almost 15 years ago · 14 revisions