Hi Hiruni, This info is documented in the RO spec [1] (section 2.9), but we get quite a few people asking similar questions so I guess I didn't write that section clearly enough....
As I think you've figured out, actions can be invoked either by GET, PUT or POST; this is dependent on their @Action(semantics=...) of SAFE, IDEMPOTENT and NON_IDEMPOTENT respectively. In the case of GET, the arguments are part of the URL. This can either be in a simplified format (as in your example, sect 2.9.1 or RO spec), or in an encoded string (2.10) In the case of PUT and POST, the arguments are part of the body (also documented in 2.10). So, your issue is that you've combined the two options, which isn't gonna work. ~~~ While I was drafting this reply Martin also posted a reply; I think his example is almost right, except that instead of -X GET it should be -X POST. This screencast I did a while ago [2] might also help. Cheers Dan [1] http://restfulobjects.org/ [2] https://www.youtube.com/watch?v=_-TOvVYWCHc On 9 April 2015 at 20:24, Martin Grigorov <[email protected]> wrote: > Hi, > > I think you have to send the parameter as a JSON body. > Something like: > curl -H "Content-Type: application/json" -X GET -d '{"param": {"value": > "hello"}}' > http://localhost:8080/restful/services/EchoService/actions/echoParam/invoke > > Check: > > http://isis.apache.org/components/viewers/restfulobjects/using-chrome-tools.html > > Martin Grigorov > Freelancer, available for hire! > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Thu, Apr 9, 2015 at 10:01 PM, Hiruni Madola <[email protected]> > wrote: > > > Hi Everyone, > > > > I tried different ways of calling the REST end point passing arguments > with > > curl. > > > > eg : curl -X POST -u sven:pass -d "param=hello" > > > http://localhost:8080/restful/services/EchoService/actions/echoParam/invoke > > < > > > http://localhost:8080/restful/services/EchoService/actions/echoParam/invoke?param=hello > > > > > > > But I still get the same error response > > : {"param":{"value":"hello"},"x-ro-invalidReason":"Argument 'param' found > > but no such parameter"} > > > > Although the error response states there is no such parameter, in my > > Service method I have defined the parameter as properly. > > > > I might be overlooking some basics here. > > But can someone please give me a hint what I may have done wrong? > > > > Or is this an inherent issue with argument passing in Apache Isis Rest > API? > > Any help is much appreciated. > > > > Regards, > > Hiruni > > > > > > > > > > On Thu, Apr 9, 2015 at 3:23 PM, Hiruni Madola <[email protected]> > > wrote: > > > > > Hi All, > > > > > > I have a question about passing arguments when invoking a REST endpoint > > in > > > Apache Isis. > > > > > > In my sample service I have a method to echo the parameter I pass to > it. > > > > > > public String echoParam(String param) > > > { > > > return "echo "+param ; > > > } > > > > > > I invoke this using curl as : > > > curl -X POST -u sven:pass > > > > > > http://localhost:8080/restful/services/EchoService/actions/echoParam/invoke?param=hello > > > > > > I cannot get the desire result and I get below as the response; > > > > > > {"param":{"value":"hello"},"x-ro-invalidReason":"Argument 'param' found > > > but no such parameter"} > > > > > > Can you please advice on how to pass an argument to the REST service > > > endpoint when invoking via a REST client? > > > > > > Regards, > > > Hiruni > > > > > > > > > > > > -- > > Hiru > > >
