Hi Kambiz, sorry not to reply sooner.
The framework doesn't currently provide any mechanism to plug-in alternative mechanisms for parsing inbound arguments; the REST API supports only the format defined in the Restful Objects spec [1] However, there's nothing to prevent you from defining your own additional REST resources, by defining and registering [2] your own subclass of RestfulObjectsApplication. HTH Dan [1] http://restfulobjects.org [2] https://github.com/isisaddons/isis-app-todoapp/blob/master/webapp/src/main/webapp/WEB-INF/web.xml#L271 On 3 February 2016 at 20:11, Kambiz Darabi <dar...@m-creations.com> wrote: > Hi, > > I'm wrestling with a service which is going to be called by a > hand-written javascript client (written by others). The client wants to > send something like this: > > { > "urls": [ { "id": "test-1", "url": "http://example.com/abc" }, { > "id": "test-2", "url": "http://example.com/def" } ] > } > > and get back > > { > "urls": [ { "id": "test-1", "url": "http://example.com/ybpnyubftnnfwqs" > }, { "id": "test-2", "url": "http://example.com/63dgjrevlhnsufqw" } ] > } > > > The second part was simple. I created > > @ViewModel > public class IdentifiedUrl { > protected String id; > protected String url; > ... > > and > > @ViewModel > public class UrlList { > protected Set<IdentifiedUrl> urls; > ... > > Then, in my domain service, I can create an action: > > public UrlList encodeUrls(@Parameter @ParameterLayout(named = "urls") > String urls) > HashSet<IdentifiedUrl> responseUrls= new HashSet<IdentifiedUrl>(); > responseUrls.add(new IdentifiedUrl("test-1", " > http://example.com/102398432313410948710798713028941209374")); > responseUrls.add(new IdentifiedUrl("test-2", " > http://example.com/123452309028954723049875023152310239843")); > return new UrlList(responseUrls); > } > > and when called with the header Accept: > application/json;profile="urn:org.apache.isis/v1", > returns > > { > "urls" : [ { > "$$href" : " > http://localhost:12080/restful/objects/com.example.mas.dom.services.IdentifiedUrl/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8vPg== > ", > "$$title" : "Untitled Identified Url", > "$$instanceId" : > "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8vPg==", > "id" : "test-2", > "url" : "http://example.com/123452309028954723049875023152310239843" > }, { > "$$href" : " > http://localhost:12080/restful/objects/com.example.mas.dom.services.IdentifiedUrl/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8vPg== > ", > "$$title" : "Untitled Identified Url", > "$$instanceId" : > "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8vPg==", > "id" : "test-1", > "url" : "http://example.com/102398432313410948710798713028941209374" > } ] > } > > > But regarding the action argument, I don't get anywhere. Can someone > please propose which direction to take? It would be helpful if the JSON > which needs to be posted could be in a 'simple' representation. > > Thanks a lot > > > Kambiz >