Apache Tuscany > Home > SCA Overview > SCA Native > SCA Native Work-in-progress > SCA CPP Users > SCA CPP Bindings REST User List | Dev List | Issue Tracker  

REST Resource Patterns

If the service/reference uses an <interface.rest> interface, we map CRUD
methods to HTTP verbs to access resource representations as follows:

resource = retrieve()
-> GET <binding-uri>
<- an XML element representing the REST resource

resource = retrieve(uri, parm-value-1, parm-value-n)
-> GET uri/parm-value-1/parm-value-n
or if uri ends with a '?'
-> GET uri?parm-name-1=parm-value1&parm-name-n=parm-value-n
<- an XML element representing the REST resource

uri = create(resource)
-> POST <binding-uri> + an XML element representing the resource to create
<- Location header containing the uri of the created resource

update(resource)
-> PUT <binding-uri> + an XML element representing the updated resource

update(uri, parm-1, parm-n, resource)
-> PUT uri/parm-value-1/parm-value-n + an XML element representing the updated resource
or if uri ends with a '?'
-> PUT uri?parm-name-1=parm-value1&parm-name-n=parm-value-n + an XML element representing the updated resource

delete()
-> DELETE <binding-uri>

delete(uri, parm-1, parm-n)
-> DELETE uri/parm-value-1/parm-value-n
or if uri ends with a '?'
-> DELETE uri?parm-name-1=parm-value1&parm-name-n=parm-value-n

In this mode, HTTP return codes are used almost as described in the Atom spec. Also GET returns etags with the retrieved resource representations to help caching by clients.

REST RPC Patterns

If the service/reference does not use an <interface.rest> interface, then this is not a real REST pattern, we simply flow method calls over XML / HTTP as follows:

result = method-abc(parm-1, parm-n)

if single input parameter of complex type
-> POST <binding-uri>/method-abc + XML element representing the complex parameter or if multiple parameters including parameters of complex types
-> POST <binding-uri>/method-abc + Mime multipart/form-data body containing one parameter per part or if multiple parameters all of simple types
-> GET
<binding-uri>/method-abc?parm-1-name=parm-1-value&parm-n-name=parm-n-value

<- an XML element representing the result

website stats