This page was moved to https://cwiki.apache.org/confluence/display/CAUSEWAY/Restful Json Protocol
Click in the link above if you are not automatically redirected in 10 seconds.


Building Blocks for Representations

Representations of references and of types are used to make up other representations.

Resources to represent a single Domain Object

Notes:

  • Action has an additional '/invoke subresource that is used for invoking the action
  • A 405 ('method not allowed') is returned where a resource is available for some HTTP methods but not for the one specified
  • all validation (except that of individual parameter arguments) is performed immediately prior to the interaction
    • that is, there is no specific resource to validate a property change, adding/removing from collections, or the full set of action arguments
    • failed validation is indicated by the return code 412 "precondition failed"
    • if required, individual parameter arguments can be validated by using PUT on the Action
    • ?? a custom header can be used to request validation only ??
  • the distinction betweeen action validation and action parameters validation is that the former validates arguments for all parameters, whereas the latter validate an argument for only a single parameter.

Example Resources

Resource Type

Resource endpoint

GET

PUT

DELETE

POST

object

http://localhost:8080/com.mycompany.Order|123

Y

Y

.

.

property

http://localhost:8080/com.mycompany.Order|123/createdOn

Y

Y

Y

.

collection

http://localhost:8080/com.mycompany.Order|123/items

Y

Y

Y

Y

action

http://localhost:8080/com.mycompany.Order|123/placeOrder

Y

Y

.

.

action invocation

http://localhost:8080/com.mycompany.Order|123/placeOrder/invoke

Y

.

.

Y

Resource to represent the set of available (registered) Domain Services

The 'services' resource is a well-known endpoint from which a representation of the collection of domain services is obtained. It is analogous to index.html.

Resources to represent a collection of Domain Objects

Collections of domain objects can be returned either as the result of an action invocation, or as the result of obtaining the contents of an object collection. In both cases the usual JSON syntax for a list is used.

Resources to represent the currently logged on user

The 'user' resource is a well-known endpoint from which a representation of the currently logged-in user can be obtained.

Resource to represent a type

The 'types/application/vnd+xxx' resource describes the type of an object (from the metamodel).


  • No labels