You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Michael Kyrilov <mi...@ecn.co.za> on 2015/04/02 09:35:11 UTC

REST API

Hi there,

My name is Michael. I have recently been tasked to develop a User Interface on top of an Apache Isis application.
Isis was originally chosen due to time constrains for the project, this way the team was able to get a functional UI but remain heavily focused on implementing the business logic.

Our understanding is that Isis provides a REST API for interacting with the domain model, which sounds ideal for building a User Interface.
I have managed to locate an API: http://host:port/restful/

I am having difficulties understanding how to interact with this API.
I do see that /services the models we have defined and /domain-types does much the same.
We do have data in the database and the difficulty I am having is that I am unable to get data out of this API and I also don’t see how I can POST data via the API so that it would be saved in the database.


I am not sure if I am misunderstanding how this works or if I am trying to use it inappropriately.


Thank you
Regards,
Michael

Michael Kyrilov
Mid-Level Developer


[http://static.ecntelecoms.za.net/images/ecn-logo.png]

Unit 10 Growthpoint Business Park
2 Tonnetti Street, Midrand, 1685
Office: +27 10 590 0035
Cell: +27 72 634 9687

michael@ecn.co.za
www.ecn.co.za<http://www.ecn.co.za/>


 This email is sent subject to the terms and conditions detailed in the ECN Email Disclaimer<http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/>

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. 
If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware.

Re: REST API

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Glad to be of help.

If the BookmarkService you refer to is Isis' own BookmarkService, then
(like any other of the Isis domain services) this can simply be injected
into your repository:

@javax.inject.Inject
BookmarkService bookmarkService;

HTH
Dan






On 7 April 2015 at 10:50, Michael Kyrilov <mi...@ecn.co.za> wrote:

> Hello Dan,
>
> Thank you very much for your response.
> Unfortunately I haven’t been involved in the development of the app thus
> far, my involvement now is to build a user interface.
> However a quick look in our “ContextAwareAbstractFactoryAndRepository”
> class shows that a BookmarkService is being utilised. It appears that some
> instance ID is being stored in the session.
>
> On the upside, I have refactored our app to not utilise this class. While
> I’m sure I have broken some business logic, this has yielded success for
> the Rest API calls.
> The operations I was battling with earlier are now working properly.
>
>
> I will consult with my collages that were involved in the development of
> the app and I’m sure we will be abel to work around our implementation
> error.
>
> Thank you very much, you’ve been a tremendous help to me!
>
> Regards,
> Michael
>
>
>
> > On 07 Apr 2015, at 10:32 AM, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
> >
> > Hi Michael,
> >
> > some thoughts within...
> >
> >
> > On 7 April 2015 at 07:21, Michael Kyrilov <michael@ecn.co.za ><mailto:
> michael@ecn.co.za>> wrote:
> >
> >>
> >> Lets look at a simple one first.
> >>
> >> The URL is:
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll
> >
> >> <
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll
> >
> >>>
> >> The following is what I see onscreen:
> >> {
> >>
> >        ...
> >
> >>  , {
> >>    "rel" : "urn:org.restfulobjects:rels/invoke;action=\"listAll\"",
> >>    "href" : "
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> >
> >> ",
> >>    "method" : "GET",
> >>    "type" :
> >>
> "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
> >>    "arguments" : { }
> >>  },
> >>
> >      ...
> >
> >> }
> >> My understanding of this is that if I visit:
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> >
> >> <
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> >
> >>>
> >> with no arguments I should get a list of all my Users from the database.
> >>
> >
> >
> > yes, that's correct.
> >
> >
> >
> >> This is not the case, in fact I get an error message:
> >> {
> >>  "message" : "There is no application attached to current thread
> >> 1501572129@qtp-836514715-3",
> >>  "stackTrace" : [
> >
> >
> >
> >> "org.apache.wicket.Application.get(Application.java:239)",
> >
> >
> >
> >>
> "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)",
> >>
> >
> >
> >
> >>
> "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)",
> >>
> >
> >
> >
> >>
> "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)",
> >>
> >
> >
> >
> >> "com.ecntelecoms.vbx.domain.contact.Users.listAll(Users.java:37)",
> >
> >
> > ...
> >
> >
> >>
> "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeActionQueryOnly(DomainServiceResourceServerside.java:165)",
> >>
> >
> >
> >
> >> Here I am interested to know if this is an implementation problem in our
> >> app or if I am misusing the API?
> >>
> >>
> > A bit of both, I think.
> >
> > The stacktrace shows that in your class
> > ContextAwareAbstractFactoryAndRepository.contextVpbx(...) you are calling
> > the Wicket API.  However, the Wicket application is only available when
> the
> > domain objects are interacted with through the Wicket viewer, which isn't
> > the case here, of course.
> >
> > Do you know why ContextAwareAbstractFactoryAndRepository needs Wicket
> > application?  I think that will need to be refactored/abstracted somehow
> > such that your domain objects can also be used from the RO viewer.
> >
> > Also, if you want to do any integration testing of your classes, removing
> > that dependency on Wicket is probably a good idea.
> >
> >
> >
> >
> >>
> >>
> >> A more complicated scenario:
> >> The URL is:
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create
> >
> >> <
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create
> >
> >>>
> >> Again we are dealing with the Users object, but this time we’d like to
> >> create a new user.
> >> The following is what I see on screen:
> >> {
> >>
> >    ...
> >
> >>  }, {
> >>    "rel" : "urn:org.restfulobjects:rels/invoke;action=\"create\"",
> >>    "href" : "
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke
> >
> >> ",
> >>    "method" : "POST",
> >>    "type" :
> >>
> "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
> >>    "arguments" : {
> >>      "firstName" : {
> >>        "value" : null
> >>      },
> >>      "lastName" : {
> >>        "value" : null
> >>      },
> >>      "pIN" : {
> >>        "value" : null
> >>      },
> >>      "type" : {
> >>        "value" : null
> >>      }
> >>    }
> >>  },
> >
> >
> >
> >> ...
> >>  "parameters" : {
> >>    "firstName" : {
> >>      "num" : 0,
> >>      "id" : "firstName",
> >>      "name" : "First Name",
> >>      "description" : ""
> >>    },
> >>    "lastName" : {
> >>      "num" : 1,
> >>      "id" : "lastName",
> >>      "name" : "Last Name",
> >>      "description" : ""
> >>    },
> >>    "pIN" : {
> >>      "num" : 2,
> >>      "id" : "pIN",
> >>      "name" : "PIN",
> >>      "description" : ""
> >>    },
> >>    "type" : {
> >>      "num" : 3,
> >>      "id" : "type",
> >>      "name" : "Type",
> >>      "description" : "",
> >>      "choices" : [ "some_user_type", "another_user_type", "super_user" ]
> >>    }
> >>  }
> >> }
> >> So here I do a POST request to:
> >>
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke
> >
> >>
> >> with the following body as JSON:
> >>
> >> {
> >>  "firstName": {
> >>    "value": "REST"
> >>  },
> >>  "lastName": {
> >>    "value": "FUL"
> >>  },
> >>  "pIN": {
> >>    "value": "1234"
> >>  },
> >>  "type": {
> >>    "value": "super_user"
> >>  }
> >> }
> >>
> >>
> >
> > This looks correct to me.
> >
> >
> >
> >> This is the response I get:
> >> {
> >>  "httpStatusCode" : 0,
> >>  "message" : "Unrecognized token 'firstName': was expecting \n at
> >> [Source: java.io.StringReader@38d5fe99; line: 1, column: 10]",
> >>
> >
> > seems like some sort of parsing issue.  Given what you describe below,
> > perhaps depends on what you mean by "send as JSON"...
> >
> > reading on....
> >
> >
> >
> >>
> >> I have also tried sending the POST request with a string body, in that
> >> case we get:
> >> {
> >>  "message" : "There is no application attached to current thread
> >> 1501572129@qtp-836514715-3",
> >>  "stackTrace" : [
> >
> >
> >
> >> "org.apache.wicket.Application.get(Application.java:239)",
> >
> >
> >
> >>
> "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)",
> >>
> >
> >
> >
> >>
> "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)",
> >>
> >
> >
> >
> >>
> "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)",
> >>
> >
> >
> >
> >> "com.ecntelecoms.vbx.domain.contact.Users.create(Users.java:66)",
> >
> > ...
> >
> >>
> "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeAction(DomainServiceResourceServerside.java:204)",
> >>
> >
> >
> >
> > However you submitted the request here ("as a string body") has worked;
> the
> > stack trace shows that the Users#create method has been called.  And then
> > we have the same issue as before; there is no Wicket application
> available.
> >
> >
> >
> >
> >> I’d like to thank you for taking the time to read through my questions.
> >>
> >
> > No worries!
> >
> >
> >> I know I have provided a very specific example, however I feel that if a
> >> solution is found here, others can more easily adapt that to their own
> work.
> >>
> >>
> > Indeed.  I don't know if there's anywhere that we have explicitly
> > documented that the Wicket API is not available if invoked via the RO
> > viewer.  It's probably "obvious" if one knows how Isis works internally;
> > but that's hardly the point.
> >
> > Come back to us if you need help abstracting away that usage of the
> Wicket
> > API.
> >
> > Cheers
> > Dan
> >
> >
> >
> >
> >> Regards,
> >> Michael
> >>
> >>> On 02 Apr 2015, at 2:58 PM, Hiruni Madola <hirunimadola@gmail.com
> ><ma...@gmail.com>>
> >> wrote:
> >>>
> >>> Hi Dan,
> >>>
> >>> I got a related question about parameter passing when invoking ISIS
> Rest
> >>> API.
> >>>
> >>> 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
> <
> 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 a parameter to the REST service
> when
> >>> invoking via a REST client?
> >>>
> >>> Regards,
> >>> Hiruni
> >>>
> >>> On Thu, Apr 2, 2015 at 5:21 PM, Dan Haywood <
> >> dan@haywood-associates.co.uk <ma...@haywood-associates.co.uk>>
> >>> wrote:
> >>>
> >>>> Hi Michael,
> >>>>
> >>>> The Apache mailing lists don't accept documents, as you've discovered.
> >>>>
> >>>> Although you can mail me directly if you want [1], I'd rather you
> simply
> >>>> paste your questions here... that way your questions and hopefully
> some
> >>>> answers will be available to others in the community to discover/learn
> >>>> from.
> >>>>
> >>>> ~~~
> >>>> Meanwhile, for some additional ideas on how to use the RO API, take a
> >> look
> >>>> at our (incomplete) TCK tests [2].
> >>>>
> >>>> I'm also aware of this bespoke Angular app [3] that's being written
> as a
> >>>> front-end to this Isis back-end [4]; might give you some ideas.
> >>>>
> >>>> Another option, if the full RO representations are a built
> >> overwhelming, is
> >>>> either to configure Isis to provide a simplified representation [5] or
> >> you
> >>>> could even use custom representations [6].
> >>>>
> >>>> HTH
> >>>> Dan
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> [1] https://github.com/apache/isis/blob/master/core/pom.xml#L201 <
> https://github.com/apache/isis/blob/master/core/pom.xml#L201>
> >>>> [2]
> >>>>
> >>>>
> >>
> https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck
> <
> https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck
> >
> >>>> [3] https://github.com/edge-art/matchingfront <
> https://github.com/edge-art/matchingfront>
> >>>> [4] https://github.com/johandoornenbal/matching <
> https://github.com/johandoornenbal/matching>
> >>>> [5]
> >>>>
> >>>>
> >>
> http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html
> <
> http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html
> >
> >>>> [6]
> >>>>
> >>>>
> >>
> http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html
> <
> http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html
> >
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On 2 April 2015 at 12:15, Michael Kyrilov <mi...@ecn.co.za> wrote:
> >>>>
> >>>>> Hi Dan,
> >>>>>
> >>>>> I had looked at the Restful Objects document, unfortunately I am
> still
> >>>>> unsure of how to work with he API.
> >>>>>
> >>>>> I have prepared a short PDF highlighting what exactly my struggles
> are.
> >>>>> Unfortunately I don’t seem to be able to send it to you. Every time I
> >>>> try,
> >>>>> I get a failed notice from Mailer-deamon@apache.org <mailto:
> >>>>> Mailer-deamon@apache.org>
> >>>>> Is there any other way I say send you this document?
> >>>>>
> >>>>> Regards,
> >>>>> Michael
> >>>>>
> >>>>>> On 02 Apr 2015, at 9:46 AM, Dan Haywood <
> dan@haywood-associates.co.uk
> >>>
> >>>>> wrote:
> >>>>>>
> >>>>>> Hi Michael,
> >>>>>> Have you taken a look at the Restful Objects spec? That should give
> >>>> you a
> >>>>>> good background so you can start to understand what Isis Rest API is
> >>>>>> surfacing for you.
> >>>>>>
> >>>>>> Cheers, Dan
> >>>>>>
> >>>>>> http://restfulobjects.org
> >>>>>> On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:
> >>>>>>
> >>>>>>> Hi there,
> >>>>>>>
> >>>>>>> My name is Michael. I have recently been tasked to develop a User
> >>>>>>> Interface on top of an Apache Isis application.
> >>>>>>> Isis was originally chosen due to time constrains for the project,
> >>>> this
> >>>>>>> way the team was able to get a functional UI but remain heavily
> >>>> focused
> >>>>> on
> >>>>>>> implementing the business logic.
> >>>>>>>
> >>>>>>> Our understanding is that Isis provides a REST API for interacting
> >>>> with
> >>>>>>> the domain model, which sounds ideal for building a User Interface.
> >>>>>>> I have managed to locate an API: http://host:port/restful/
> >>>>>>>
> >>>>>>> I am having difficulties understanding how to interact with this
> API.
> >>>>>>> I do see that /services the models we have defined and
> /domain-types
> >>>>> does
> >>>>>>> much the same.
> >>>>>>> We do have data in the database and the difficulty I am having is
> >>>> that I
> >>>>>>> am unable to get data out of this API and I also don’t see how I
> can
> >>>>> POST
> >>>>>>> data via the API so that it would be saved in the database.
> >>>>>>>
> >>>>>>>
> >>>>>>> I am not sure if I am misunderstanding how this works or if I am
> >>>> trying
> >>>>> to
> >>>>>>> use it inappropriately.
> >>>>>>>
> >>>>>>>
> >>>>>>> Thank you
> >>>>>>> Regards,
> >>>>>>> Michael
> >>>>>>>
> >>>>>>> Michael Kyrilov
> >>>>>>> Mid-Level Developer
> >>>>>>>
> >>>>>>>
> >>>>>>> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
> >>>>>>>
> >>>>>>> Unit 10 Growthpoint Business Park
> >>>>>>> 2 Tonnetti Street, Midrand, 1685
> >>>>>>> Office: +27 10 590 0035
> >>>>>>> Cell: +27 72 634 9687
> >>>>>>>
> >>>>>>> michael@ecn.co.za
> >>>>>>> www.ecn.co.za<http://www.ecn.co.za/>
> >>>>>>>
> >>>>>>>
> >>>>>>> This email is sent subject to the terms and conditions detailed in
> >> the
> >>>>>>> ECN Email Disclaimer<
> >>>>>>>
> >>>>>
> >>
> http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/
> >>>>>
> >>>>>>>
> >>>>>>> Disclaimer
> >>>>>>>
> >>>>>>> The information contained in this communication from the sender is
> >>>>>>> confidential. It is intended solely for use by the recipient and
> >>>> others
> >>>>>>> authorized to receive it.
> >>>>>>> If you are not the recipient, you are hereby notified that any
> >>>>> disclosure,
> >>>>>>> copying, distribution or taking action in relation of the contents
> of
> >>>>> this
> >>>>>>> information is strictly prohibited and may be unlawful.
> >>>>>>>
> >>>>>>> This email has been scanned for viruses and malware.
> >>>>>
> >>>>> Disclaimer
> >>>>>
> >>>>> The information contained in this communication from the sender is
> >>>>> confidential. It is intended solely for use by the recipient and
> others
> >>>>> authorized to receive it.
> >>>>> If you are not the recipient, you are hereby notified that any
> >>>> disclosure,
> >>>>> copying, distribution or taking action in relation of the contents of
> >>>> this
> >>>>> information is strictly prohibited and may be unlawful.
> >>>>>
> >>>>> This email has been scanned for viruses and malware.
> >>>>>
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Hiru
> >>
> >> Disclaimer
> >>
> >> The information contained in this communication from the sender is
> >> confidential. It is intended solely for use by the recipient and others
> >> authorized to receive it.
> >> If you are not the recipient, you are hereby notified that any
> disclosure,
> >> copying, distribution or taking action in relation of the contents of
> this
> >> information is strictly prohibited and may be unlawful.
> >>
> >> This email has been scanned for viruses and malware.
>
> Disclaimer
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it.
> If you are not the recipient, you are hereby notified that any disclosure,
> copying, distribution or taking action in relation of the contents of this
> information is strictly prohibited and may be unlawful.
>
> This email has been scanned for viruses and malware.
>

Re: REST API

Posted by Michael Kyrilov <mi...@ecn.co.za>.
Hello Dan,

Thank you very much for your response.
Unfortunately I haven’t been involved in the development of the app thus far, my involvement now is to build a user interface.
However a quick look in our “ContextAwareAbstractFactoryAndRepository” class shows that a BookmarkService is being utilised. It appears that some instance ID is being stored in the session.

On the upside, I have refactored our app to not utilise this class. While I’m sure I have broken some business logic, this has yielded success for the Rest API calls.
The operations I was battling with earlier are now working properly.


I will consult with my collages that were involved in the development of the app and I’m sure we will be abel to work around our implementation error.

Thank you very much, you’ve been a tremendous help to me!

Regards,
Michael



> On 07 Apr 2015, at 10:32 AM, Dan Haywood <da...@haywood-associates.co.uk> wrote:
> 
> Hi Michael,
> 
> some thoughts within...
> 
> 
> On 7 April 2015 at 07:21, Michael Kyrilov <michael@ecn.co.za ><ma...@ecn.co.za>> wrote:
> 
>> 
>> Lets look at a simple one first.
>> 
>> The URL is:
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll>
>> <
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll>
>>> 
>> The following is what I see onscreen:
>> {
>> 
>        ...
> 
>>  , {
>>    "rel" : "urn:org.restfulobjects:rels/invoke;action=\"listAll\"",
>>    "href" : "
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke>
>> ",
>>    "method" : "GET",
>>    "type" :
>> "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
>>    "arguments" : { }
>>  },
>> 
>      ...
> 
>> }
>> My understanding of this is that if I visit:
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke>
>> <
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke>
>>> 
>> with no arguments I should get a list of all my Users from the database.
>> 
> 
> 
> yes, that's correct.
> 
> 
> 
>> This is not the case, in fact I get an error message:
>> {
>>  "message" : "There is no application attached to current thread
>> 1501572129@qtp-836514715-3",
>>  "stackTrace" : [
> 
> 
> 
>> "org.apache.wicket.Application.get(Application.java:239)",
> 
> 
> 
>> "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)",
>> 
> 
> 
> 
>> "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)",
>> 
> 
> 
> 
>> "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)",
>> 
> 
> 
> 
>> "com.ecntelecoms.vbx.domain.contact.Users.listAll(Users.java:37)",
> 
> 
> ...
> 
> 
>> "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeActionQueryOnly(DomainServiceResourceServerside.java:165)",
>> 
> 
> 
> 
>> Here I am interested to know if this is an implementation problem in our
>> app or if I am misusing the API?
>> 
>> 
> A bit of both, I think.
> 
> The stacktrace shows that in your class
> ContextAwareAbstractFactoryAndRepository.contextVpbx(...) you are calling
> the Wicket API.  However, the Wicket application is only available when the
> domain objects are interacted with through the Wicket viewer, which isn't
> the case here, of course.
> 
> Do you know why ContextAwareAbstractFactoryAndRepository needs Wicket
> application?  I think that will need to be refactored/abstracted somehow
> such that your domain objects can also be used from the RO viewer.
> 
> Also, if you want to do any integration testing of your classes, removing
> that dependency on Wicket is probably a good idea.
> 
> 
> 
> 
>> 
>> 
>> A more complicated scenario:
>> The URL is:
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create>
>> <
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create>
>>> 
>> Again we are dealing with the Users object, but this time we’d like to
>> create a new user.
>> The following is what I see on screen:
>> {
>> 
>    ...
> 
>>  }, {
>>    "rel" : "urn:org.restfulobjects:rels/invoke;action=\"create\"",
>>    "href" : "
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke>
>> ",
>>    "method" : "POST",
>>    "type" :
>> "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
>>    "arguments" : {
>>      "firstName" : {
>>        "value" : null
>>      },
>>      "lastName" : {
>>        "value" : null
>>      },
>>      "pIN" : {
>>        "value" : null
>>      },
>>      "type" : {
>>        "value" : null
>>      }
>>    }
>>  },
> 
> 
> 
>> ...
>>  "parameters" : {
>>    "firstName" : {
>>      "num" : 0,
>>      "id" : "firstName",
>>      "name" : "First Name",
>>      "description" : ""
>>    },
>>    "lastName" : {
>>      "num" : 1,
>>      "id" : "lastName",
>>      "name" : "Last Name",
>>      "description" : ""
>>    },
>>    "pIN" : {
>>      "num" : 2,
>>      "id" : "pIN",
>>      "name" : "PIN",
>>      "description" : ""
>>    },
>>    "type" : {
>>      "num" : 3,
>>      "id" : "type",
>>      "name" : "Type",
>>      "description" : "",
>>      "choices" : [ "some_user_type", "another_user_type", "super_user" ]
>>    }
>>  }
>> }
>> So here I do a POST request to:
>> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke>
>> 
>> with the following body as JSON:
>> 
>> {
>>  "firstName": {
>>    "value": "REST"
>>  },
>>  "lastName": {
>>    "value": "FUL"
>>  },
>>  "pIN": {
>>    "value": "1234"
>>  },
>>  "type": {
>>    "value": "super_user"
>>  }
>> }
>> 
>> 
> 
> This looks correct to me.
> 
> 
> 
>> This is the response I get:
>> {
>>  "httpStatusCode" : 0,
>>  "message" : "Unrecognized token 'firstName': was expecting \n at
>> [Source: java.io.StringReader@38d5fe99; line: 1, column: 10]",
>> 
> 
> seems like some sort of parsing issue.  Given what you describe below,
> perhaps depends on what you mean by "send as JSON"...
> 
> reading on....
> 
> 
> 
>> 
>> I have also tried sending the POST request with a string body, in that
>> case we get:
>> {
>>  "message" : "There is no application attached to current thread
>> 1501572129@qtp-836514715-3",
>>  "stackTrace" : [
> 
> 
> 
>> "org.apache.wicket.Application.get(Application.java:239)",
> 
> 
> 
>> "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)",
>> 
> 
> 
> 
>> "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)",
>> 
> 
> 
> 
>> "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)",
>> 
> 
> 
> 
>> "com.ecntelecoms.vbx.domain.contact.Users.create(Users.java:66)",
> 
> ...
> 
>> "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeAction(DomainServiceResourceServerside.java:204)",
>> 
> 
> 
> 
> However you submitted the request here ("as a string body") has worked; the
> stack trace shows that the Users#create method has been called.  And then
> we have the same issue as before; there is no Wicket application available.
> 
> 
> 
> 
>> I’d like to thank you for taking the time to read through my questions.
>> 
> 
> No worries!
> 
> 
>> I know I have provided a very specific example, however I feel that if a
>> solution is found here, others can more easily adapt that to their own work.
>> 
>> 
> Indeed.  I don't know if there's anywhere that we have explicitly
> documented that the Wicket API is not available if invoked via the RO
> viewer.  It's probably "obvious" if one knows how Isis works internally;
> but that's hardly the point.
> 
> Come back to us if you need help abstracting away that usage of the Wicket
> API.
> 
> Cheers
> Dan
> 
> 
> 
> 
>> Regards,
>> Michael
>> 
>>> On 02 Apr 2015, at 2:58 PM, Hiruni Madola <hirunimadola@gmail.com ><ma...@gmail.com>>
>> wrote:
>>> 
>>> Hi Dan,
>>> 
>>> I got a related question about parameter passing when invoking ISIS Rest
>>> API.
>>> 
>>> 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 <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 a parameter to the REST service when
>>> invoking via a REST client?
>>> 
>>> Regards,
>>> Hiruni
>>> 
>>> On Thu, Apr 2, 2015 at 5:21 PM, Dan Haywood <
>> dan@haywood-associates.co.uk <ma...@haywood-associates.co.uk>>
>>> wrote:
>>> 
>>>> Hi Michael,
>>>> 
>>>> The Apache mailing lists don't accept documents, as you've discovered.
>>>> 
>>>> Although you can mail me directly if you want [1], I'd rather you simply
>>>> paste your questions here... that way your questions and hopefully some
>>>> answers will be available to others in the community to discover/learn
>>>> from.
>>>> 
>>>> ~~~
>>>> Meanwhile, for some additional ideas on how to use the RO API, take a
>> look
>>>> at our (incomplete) TCK tests [2].
>>>> 
>>>> I'm also aware of this bespoke Angular app [3] that's being written as a
>>>> front-end to this Isis back-end [4]; might give you some ideas.
>>>> 
>>>> Another option, if the full RO representations are a built
>> overwhelming, is
>>>> either to configure Isis to provide a simplified representation [5] or
>> you
>>>> could even use custom representations [6].
>>>> 
>>>> HTH
>>>> Dan
>>>> 
>>>> 
>>>> 
>>>> 
>>>> [1] https://github.com/apache/isis/blob/master/core/pom.xml#L201 <https://github.com/apache/isis/blob/master/core/pom.xml#L201>
>>>> [2]
>>>> 
>>>> 
>> https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck <https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck>
>>>> [3] https://github.com/edge-art/matchingfront <https://github.com/edge-art/matchingfront>
>>>> [4] https://github.com/johandoornenbal/matching <https://github.com/johandoornenbal/matching>
>>>> [5]
>>>> 
>>>> 
>> http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html <http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html>
>>>> [6]
>>>> 
>>>> 
>> http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html <http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On 2 April 2015 at 12:15, Michael Kyrilov <mi...@ecn.co.za> wrote:
>>>> 
>>>>> Hi Dan,
>>>>> 
>>>>> I had looked at the Restful Objects document, unfortunately I am still
>>>>> unsure of how to work with he API.
>>>>> 
>>>>> I have prepared a short PDF highlighting what exactly my struggles are.
>>>>> Unfortunately I don’t seem to be able to send it to you. Every time I
>>>> try,
>>>>> I get a failed notice from Mailer-deamon@apache.org <mailto:
>>>>> Mailer-deamon@apache.org>
>>>>> Is there any other way I say send you this document?
>>>>> 
>>>>> Regards,
>>>>> Michael
>>>>> 
>>>>>> On 02 Apr 2015, at 9:46 AM, Dan Haywood <dan@haywood-associates.co.uk
>>> 
>>>>> wrote:
>>>>>> 
>>>>>> Hi Michael,
>>>>>> Have you taken a look at the Restful Objects spec? That should give
>>>> you a
>>>>>> good background so you can start to understand what Isis Rest API is
>>>>>> surfacing for you.
>>>>>> 
>>>>>> Cheers, Dan
>>>>>> 
>>>>>> http://restfulobjects.org
>>>>>> On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:
>>>>>> 
>>>>>>> Hi there,
>>>>>>> 
>>>>>>> My name is Michael. I have recently been tasked to develop a User
>>>>>>> Interface on top of an Apache Isis application.
>>>>>>> Isis was originally chosen due to time constrains for the project,
>>>> this
>>>>>>> way the team was able to get a functional UI but remain heavily
>>>> focused
>>>>> on
>>>>>>> implementing the business logic.
>>>>>>> 
>>>>>>> Our understanding is that Isis provides a REST API for interacting
>>>> with
>>>>>>> the domain model, which sounds ideal for building a User Interface.
>>>>>>> I have managed to locate an API: http://host:port/restful/
>>>>>>> 
>>>>>>> I am having difficulties understanding how to interact with this API.
>>>>>>> I do see that /services the models we have defined and /domain-types
>>>>> does
>>>>>>> much the same.
>>>>>>> We do have data in the database and the difficulty I am having is
>>>> that I
>>>>>>> am unable to get data out of this API and I also don’t see how I can
>>>>> POST
>>>>>>> data via the API so that it would be saved in the database.
>>>>>>> 
>>>>>>> 
>>>>>>> I am not sure if I am misunderstanding how this works or if I am
>>>> trying
>>>>> to
>>>>>>> use it inappropriately.
>>>>>>> 
>>>>>>> 
>>>>>>> Thank you
>>>>>>> Regards,
>>>>>>> Michael
>>>>>>> 
>>>>>>> Michael Kyrilov
>>>>>>> Mid-Level Developer
>>>>>>> 
>>>>>>> 
>>>>>>> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
>>>>>>> 
>>>>>>> Unit 10 Growthpoint Business Park
>>>>>>> 2 Tonnetti Street, Midrand, 1685
>>>>>>> Office: +27 10 590 0035
>>>>>>> Cell: +27 72 634 9687
>>>>>>> 
>>>>>>> michael@ecn.co.za
>>>>>>> www.ecn.co.za<http://www.ecn.co.za/>
>>>>>>> 
>>>>>>> 
>>>>>>> This email is sent subject to the terms and conditions detailed in
>> the
>>>>>>> ECN Email Disclaimer<
>>>>>>> 
>>>>> 
>> http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/
>>>>> 
>>>>>>> 
>>>>>>> Disclaimer
>>>>>>> 
>>>>>>> The information contained in this communication from the sender is
>>>>>>> confidential. It is intended solely for use by the recipient and
>>>> others
>>>>>>> authorized to receive it.
>>>>>>> If you are not the recipient, you are hereby notified that any
>>>>> disclosure,
>>>>>>> copying, distribution or taking action in relation of the contents of
>>>>> this
>>>>>>> information is strictly prohibited and may be unlawful.
>>>>>>> 
>>>>>>> This email has been scanned for viruses and malware.
>>>>> 
>>>>> Disclaimer
>>>>> 
>>>>> The information contained in this communication from the sender is
>>>>> confidential. It is intended solely for use by the recipient and others
>>>>> authorized to receive it.
>>>>> If you are not the recipient, you are hereby notified that any
>>>> disclosure,
>>>>> copying, distribution or taking action in relation of the contents of
>>>> this
>>>>> information is strictly prohibited and may be unlawful.
>>>>> 
>>>>> This email has been scanned for viruses and malware.
>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Hiru
>> 
>> Disclaimer
>> 
>> The information contained in this communication from the sender is
>> confidential. It is intended solely for use by the recipient and others
>> authorized to receive it.
>> If you are not the recipient, you are hereby notified that any disclosure,
>> copying, distribution or taking action in relation of the contents of this
>> information is strictly prohibited and may be unlawful.
>> 
>> This email has been scanned for viruses and malware.

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. 
If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware.

Re: REST API

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Michael,

some thoughts within...


On 7 April 2015 at 07:21, Michael Kyrilov <mi...@ecn.co.za> wrote:

>
> Lets look at a simple one first.
>
> The URL is:
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll
> >
> The following is what I see onscreen:
> {
>
        ...

>   , {
>     "rel" : "urn:org.restfulobjects:rels/invoke;action=\"listAll\"",
>     "href" : "
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> ",
>     "method" : "GET",
>     "type" :
> "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
>     "arguments" : { }
>   },
>
      ...

> }
> My understanding of this is that if I visit:
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke
> >
> with no arguments I should get a list of all my Users from the database.
>


yes, that's correct.



> This is not the case, in fact I get an error message:
> {
>   "message" : "There is no application attached to current thread
> 1501572129@qtp-836514715-3",
>   "stackTrace" : [



> "org.apache.wicket.Application.get(Application.java:239)",



> "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)",
>



> "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)",
>



> "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)",
>



> "com.ecntelecoms.vbx.domain.contact.Users.listAll(Users.java:37)",


...


> "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeActionQueryOnly(DomainServiceResourceServerside.java:165)",
>



> Here I am interested to know if this is an implementation problem in our
> app or if I am misusing the API?
>
>
A bit of both, I think.

The stacktrace shows that in your class
ContextAwareAbstractFactoryAndRepository.contextVpbx(...) you are calling
the Wicket API.  However, the Wicket application is only available when the
domain objects are interacted with through the Wicket viewer, which isn't
the case here, of course.

Do you know why ContextAwareAbstractFactoryAndRepository needs Wicket
application?  I think that will need to be refactored/abstracted somehow
such that your domain objects can also be used from the RO viewer.

Also, if you want to do any integration testing of your classes, removing
that dependency on Wicket is probably a good idea.




>
>
> A more complicated scenario:
> The URL is:
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create
> <
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create
> >
> Again we are dealing with the Users object, but this time we’d like to
> create a new user.
> The following is what I see on screen:
> {
>
    ...

>   }, {
>     "rel" : "urn:org.restfulobjects:rels/invoke;action=\"create\"",
>     "href" : "
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke
> ",
>     "method" : "POST",
>     "type" :
> "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
>     "arguments" : {
>       "firstName" : {
>         "value" : null
>       },
>       "lastName" : {
>         "value" : null
>       },
>       "pIN" : {
>         "value" : null
>       },
>       "type" : {
>         "value" : null
>       }
>     }
>   },



> ...
>   "parameters" : {
>     "firstName" : {
>       "num" : 0,
>       "id" : "firstName",
>       "name" : "First Name",
>       "description" : ""
>     },
>     "lastName" : {
>       "num" : 1,
>       "id" : "lastName",
>       "name" : "Last Name",
>       "description" : ""
>     },
>     "pIN" : {
>       "num" : 2,
>       "id" : "pIN",
>       "name" : "PIN",
>       "description" : ""
>     },
>     "type" : {
>       "num" : 3,
>       "id" : "type",
>       "name" : "Type",
>       "description" : "",
>       "choices" : [ "some_user_type", "another_user_type", "super_user" ]
>     }
>   }
> }
> So here I do a POST request to:
> http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke
>
> with the following body as JSON:
>
> {
>   "firstName": {
>     "value": "REST"
>   },
>   "lastName": {
>     "value": "FUL"
>   },
>   "pIN": {
>     "value": "1234"
>   },
>   "type": {
>     "value": "super_user"
>   }
> }
>
>

This looks correct to me.



> This is the response I get:
> {
>   "httpStatusCode" : 0,
>   "message" : "Unrecognized token 'firstName': was expecting \n at
> [Source: java.io.StringReader@38d5fe99; line: 1, column: 10]",
>

seems like some sort of parsing issue.  Given what you describe below,
perhaps depends on what you mean by "send as JSON"...

reading on....



>
> I have also tried sending the POST request with a string body, in that
> case we get:
> {
>   "message" : "There is no application attached to current thread
> 1501572129@qtp-836514715-3",
>   "stackTrace" : [



> "org.apache.wicket.Application.get(Application.java:239)",



> "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)",
>



> "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)",
>



> "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)",
>



> "com.ecntelecoms.vbx.domain.contact.Users.create(Users.java:66)",

 ...

>  "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeAction(DomainServiceResourceServerside.java:204)",
>



However you submitted the request here ("as a string body") has worked; the
stack trace shows that the Users#create method has been called.  And then
we have the same issue as before; there is no Wicket application available.




> I’d like to thank you for taking the time to read through my questions.
>

No worries!


> I know I have provided a very specific example, however I feel that if a
> solution is found here, others can more easily adapt that to their own work.
>
>
Indeed.  I don't know if there's anywhere that we have explicitly
documented that the Wicket API is not available if invoked via the RO
viewer.  It's probably "obvious" if one knows how Isis works internally;
but that's hardly the point.

Come back to us if you need help abstracting away that usage of the Wicket
API.

Cheers
Dan




> Regards,
> Michael
>
> > On 02 Apr 2015, at 2:58 PM, Hiruni Madola <hi...@gmail.com>
> wrote:
> >
> > Hi Dan,
> >
> > I got a related question about parameter passing when invoking ISIS Rest
> > API.
> >
> > 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 a parameter to the REST service when
> > invoking via a REST client?
> >
> > Regards,
> > Hiruni
> >
> > On Thu, Apr 2, 2015 at 5:21 PM, Dan Haywood <
> dan@haywood-associates.co.uk>
> > wrote:
> >
> >> Hi Michael,
> >>
> >> The Apache mailing lists don't accept documents, as you've discovered.
> >>
> >> Although you can mail me directly if you want [1], I'd rather you simply
> >> paste your questions here... that way your questions and hopefully some
> >> answers will be available to others in the community to discover/learn
> >> from.
> >>
> >> ~~~
> >> Meanwhile, for some additional ideas on how to use the RO API, take a
> look
> >> at our (incomplete) TCK tests [2].
> >>
> >> I'm also aware of this bespoke Angular app [3] that's being written as a
> >> front-end to this Isis back-end [4]; might give you some ideas.
> >>
> >> Another option, if the full RO representations are a built
> overwhelming, is
> >> either to configure Isis to provide a simplified representation [5] or
> you
> >> could even use custom representations [6].
> >>
> >> HTH
> >> Dan
> >>
> >>
> >>
> >>
> >> [1] https://github.com/apache/isis/blob/master/core/pom.xml#L201
> >> [2]
> >>
> >>
> https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck
> >> [3] https://github.com/edge-art/matchingfront
> >> [4] https://github.com/johandoornenbal/matching
> >> [5]
> >>
> >>
> http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html
> >> [6]
> >>
> >>
> http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html
> >>
> >>
> >>
> >>
> >> On 2 April 2015 at 12:15, Michael Kyrilov <mi...@ecn.co.za> wrote:
> >>
> >>> Hi Dan,
> >>>
> >>> I had looked at the Restful Objects document, unfortunately I am still
> >>> unsure of how to work with he API.
> >>>
> >>> I have prepared a short PDF highlighting what exactly my struggles are.
> >>> Unfortunately I don’t seem to be able to send it to you. Every time I
> >> try,
> >>> I get a failed notice from Mailer-deamon@apache.org <mailto:
> >>> Mailer-deamon@apache.org>
> >>> Is there any other way I say send you this document?
> >>>
> >>> Regards,
> >>> Michael
> >>>
> >>>> On 02 Apr 2015, at 9:46 AM, Dan Haywood <dan@haywood-associates.co.uk
> >
> >>> wrote:
> >>>>
> >>>> Hi Michael,
> >>>> Have you taken a look at the Restful Objects spec? That should give
> >> you a
> >>>> good background so you can start to understand what Isis Rest API is
> >>>> surfacing for you.
> >>>>
> >>>> Cheers, Dan
> >>>>
> >>>> http://restfulobjects.org
> >>>> On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:
> >>>>
> >>>>> Hi there,
> >>>>>
> >>>>> My name is Michael. I have recently been tasked to develop a User
> >>>>> Interface on top of an Apache Isis application.
> >>>>> Isis was originally chosen due to time constrains for the project,
> >> this
> >>>>> way the team was able to get a functional UI but remain heavily
> >> focused
> >>> on
> >>>>> implementing the business logic.
> >>>>>
> >>>>> Our understanding is that Isis provides a REST API for interacting
> >> with
> >>>>> the domain model, which sounds ideal for building a User Interface.
> >>>>> I have managed to locate an API: http://host:port/restful/
> >>>>>
> >>>>> I am having difficulties understanding how to interact with this API.
> >>>>> I do see that /services the models we have defined and /domain-types
> >>> does
> >>>>> much the same.
> >>>>> We do have data in the database and the difficulty I am having is
> >> that I
> >>>>> am unable to get data out of this API and I also don’t see how I can
> >>> POST
> >>>>> data via the API so that it would be saved in the database.
> >>>>>
> >>>>>
> >>>>> I am not sure if I am misunderstanding how this works or if I am
> >> trying
> >>> to
> >>>>> use it inappropriately.
> >>>>>
> >>>>>
> >>>>> Thank you
> >>>>> Regards,
> >>>>> Michael
> >>>>>
> >>>>> Michael Kyrilov
> >>>>> Mid-Level Developer
> >>>>>
> >>>>>
> >>>>> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
> >>>>>
> >>>>> Unit 10 Growthpoint Business Park
> >>>>> 2 Tonnetti Street, Midrand, 1685
> >>>>> Office: +27 10 590 0035
> >>>>> Cell: +27 72 634 9687
> >>>>>
> >>>>> michael@ecn.co.za
> >>>>> www.ecn.co.za<http://www.ecn.co.za/>
> >>>>>
> >>>>>
> >>>>> This email is sent subject to the terms and conditions detailed in
> the
> >>>>> ECN Email Disclaimer<
> >>>>>
> >>>
> http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/
> >>>
> >>>>>
> >>>>> Disclaimer
> >>>>>
> >>>>> The information contained in this communication from the sender is
> >>>>> confidential. It is intended solely for use by the recipient and
> >> others
> >>>>> authorized to receive it.
> >>>>> If you are not the recipient, you are hereby notified that any
> >>> disclosure,
> >>>>> copying, distribution or taking action in relation of the contents of
> >>> this
> >>>>> information is strictly prohibited and may be unlawful.
> >>>>>
> >>>>> This email has been scanned for viruses and malware.
> >>>
> >>> Disclaimer
> >>>
> >>> The information contained in this communication from the sender is
> >>> confidential. It is intended solely for use by the recipient and others
> >>> authorized to receive it.
> >>> If you are not the recipient, you are hereby notified that any
> >> disclosure,
> >>> copying, distribution or taking action in relation of the contents of
> >> this
> >>> information is strictly prohibited and may be unlawful.
> >>>
> >>> This email has been scanned for viruses and malware.
> >>>
> >>
> >
> >
> >
> > --
> > Hiru
>
> Disclaimer
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it.
> If you are not the recipient, you are hereby notified that any disclosure,
> copying, distribution or taking action in relation of the contents of this
> information is strictly prohibited and may be unlawful.
>
> This email has been scanned for viruses and malware.
>

Re: REST API

Posted by Michael Kyrilov <mi...@ecn.co.za>.
Hi Dan,

What I had done in the document was take screenshots of what I see in the web browser and I added annotations to convey my message.
Given our limitations, let me attempt to convert all that to text.

Lets look at a simple one first.

The URL is: http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll>
The following is what I see onscreen:
{
  "id" : "listAll",
  "memberType" : "action",
  "links" : [ {
    "rel" : "self",
    "href" : "http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll",
    "method" : "GET",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
  }, {
    "rel" : "up",
    "href" : "http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users",
    "method" : "GET",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object\"",
    "title" : "Users"
  }, {
    "rel" : "urn:org.restfulobjects:rels/invoke;action=\"listAll\"",
    "href" : "http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke",
    "method" : "GET",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
    "arguments" : { }
  }, {
    "rel" : "describedby",
    "href" : "http://localhost:8080/restful/domain-types/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll",
    "method" : "GET",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/action-description\""
  } ],
  "extensions" : {
    "actionType" : "user",
    "actionSemantics" : "safe"
  },
  "parameters" : { }
}
My understanding of this is that if I visit: http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/listAll/invoke>
with no arguments I should get a list of all my Users from the database.
This is not the case, in fact I get an error message:
{
  "message" : "There is no application attached to current thread 1501572129@qtp-836514715-3",
  "stackTrace" : [ "org.apache.wicket.Application.get(Application.java:239)", "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)", "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)", "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)", "com.ecntelecoms.vbx.domain.contact.Users.listAll(Users.java:37)", "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)", "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(Method.java:483)", "org.apache.isis.core.metamodel.facets.actions.interaction.ActionInvocationFacetForInteractionAbstract.internalInvoke(ActionInvocationFacetForInteractionAbstract.java:314)", "org.apache.isis.core.metamodel.facets.actions.interaction.ActionInvocationFacetForInteractionAbstract.invoke(ActionInvocationFacetForInteractionAbstract.java:188)", "org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:57)", "org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:54)", "org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:201)", "org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:54)", "org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl.execute(ObjectActionImpl.java:367)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeActionUsingAdapters(DomainResourceHelper.java:266)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeActionQueryOnly(DomainResourceHelper.java:211)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeActionQueryOnly(DomainServiceResourceServerside.java:165)", "sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)", "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(Method.java:483)", "org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)", "org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)", "org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)", "org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:806)", "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)", "org.apache.isis.viewer.restfulobjects.server.webapp.IsisTransactionFilterForRestfulObjects.doFilter(IsisTransactionFilterForRestfulObjects.java:41)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.isis.core.webapp.IsisSessionFilter$SessionState$1.handle(IsisSessionFilter.java:320)", "org.apache.isis.core.webapp.IsisSessionFilter.doFilter(IsisSessionFilter.java:409)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter.doFilter(IsisLogOnExceptionFilter.java:52)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)", "org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)", "org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)", "org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)", "org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)", "org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)", "org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)", "org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)", "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)", "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)", "org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)", "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)", "org.mortbay.jetty.Server.handle(Server.java:326)", "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)", "org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)", "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)", "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)", "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)", "org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)", "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)" ],
  "causedBy" : null
}
Here I am interested to know if this is an implementation problem in our app or if I am misusing the API?



A more complicated scenario:
The URL is: http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create>
Again we are dealing with the Users object, but this time we’d like to create a new user.
The following is what I see on screen:
{
  "id" : "create",
  "memberType" : "action",
  "links" : [ {
    "rel" : "self",
    "href" : "http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create",
    "method" : "GET",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
  }, {
    "rel" : "up",
    "href" : "http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users",
    "method" : "GET",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object\"",
    "title" : "Users"
  }, {
    "rel" : "urn:org.restfulobjects:rels/invoke;action=\"create\"",
    "href" : "http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke",
    "method" : "POST",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"",
    "arguments" : {
      "firstName" : {
        "value" : null
      },
      "lastName" : {
        "value" : null
      },
      "pIN" : {
        "value" : null
      },
      "type" : {
        "value" : null
      }
    }
  }, {
    "rel" : "describedby",
    "href" : "http://localhost:8080/restful/domain-types/com.ecntelecoms.vbx.domain.contact.Users/actions/create",
    "method" : "GET",
    "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/action-description\""
  } ],
  "extensions" : {
    "actionType" : "user",
    "actionSemantics" : "nonIdempotent"
  },
  "parameters" : {
    "firstName" : {
      "num" : 0,
      "id" : "firstName",
      "name" : "First Name",
      "description" : ""
    },
    "lastName" : {
      "num" : 1,
      "id" : "lastName",
      "name" : "Last Name",
      "description" : ""
    },
    "pIN" : {
      "num" : 2,
      "id" : "pIN",
      "name" : "PIN",
      "description" : ""
    },
    "type" : {
      "num" : 3,
      "id" : "type",
      "name" : "Type",
      "description" : "",
      "choices" : [ "some_user_type", "another_user_type", "super_user" ]
    }
  }
}
So here I do a POST request to: http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke <http://localhost:8080/restful/services/com.ecntelecoms.vbx.domain.contact.Users/actions/create/invoke>
with the following body as JSON:

{
  "firstName": {
    "value": "REST"
  },
  "lastName": {
    "value": "FUL"
  },
  "pIN": {
    "value": "1234"
  },
  "type": {
    "value": "super_user"
  }
}

This is the response I get:
{
  "httpStatusCode" : 0,
  "message" : "Unrecognized token 'firstName': was expecting \n at [Source: java.io.StringReader@38d5fe99; line: 1, column: 10]",
  "stackTrace" : [ "org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)", "org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)", "org.codehaus.jackson.impl.ReaderBasedParser._reportInvalidToken(ReaderBasedParser.java:1812)", "org.codehaus.jackson.impl.ReaderBasedParser._matchToken(ReaderBasedParser.java:1644)", "org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:459)", "org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770)", "org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)", "org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)", "org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper.read(JsonMapper.java:151)", "org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper.read(JsonMapper.java:147)", "org.apache.isis.viewer.restfulobjects.rendering.util.Util.read(Util.java:92)", "org.apache.isis.viewer.restfulobjects.rendering.util.Util.readQueryStringAsMap(Util.java:76)", "org.apache.isis.viewer.restfulobjects.server.ResourceContext.requestArgsAsMap(ResourceContext.java:194)", "org.apache.isis.viewer.restfulobjects.server.ResourceContext.getQueryStringAsJsonRepr(ResourceContext.java:170)", "org.apache.isis.viewer.restfulobjects.server.ResourceContext.init(ResourceContext.java:111)", "org.apache.isis.viewer.restfulobjects.server.ResourceContext.<init>(ResourceContext.java:106)", "org.apache.isis.viewer.restfulobjects.server.resources.ResourceAbstract.init(ResourceAbstract.java:101)", "org.apache.isis.viewer.restfulobjects.server.resources.ResourceAbstract.init(ResourceAbstract.java:87)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeAction(DomainServiceResourceServerside.java:197)", "sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)", "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(Method.java:483)", "org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)", "org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)", "org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)", "org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:806)", "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)", "org.apache.isis.viewer.restfulobjects.server.webapp.IsisTransactionFilterForRestfulObjects.doFilter(IsisTransactionFilterForRestfulObjects.java:41)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.isis.core.webapp.IsisSessionFilter$SessionState$1.handle(IsisSessionFilter.java:320)", "org.apache.isis.core.webapp.IsisSessionFilter.doFilter(IsisSessionFilter.java:409)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter.doFilter(IsisLogOnExceptionFilter.java:52)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)", "org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)", "org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)", "org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)", "org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)", "org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)", "org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)", "org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)", "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)", "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)", "org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)", "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)", "org.mortbay.jetty.Server.handle(Server.java:326)", "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)", "org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)", "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)", "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)", "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)", "org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)", "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)" ],
  "causedBy" : null
}

I have also tried sending the POST request with a string body, in that case we get:
{
  "message" : "There is no application attached to current thread 1501572129@qtp-836514715-3",
  "stackTrace" : [ "org.apache.wicket.Application.get(Application.java:239)", "org.apache.wicket.protocol.http.WebApplication.get(WebApplication.java:156)", "org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.get(IsisWicketApplication.java:134)", "com.ecntelecoms.vbx.domain.ContextAwareAbstractFactoryAndRepository.contextVpbx(ContextAwareAbstractFactoryAndRepository.java:30)", "com.ecntelecoms.vbx.domain.contact.Users.create(Users.java:66)", "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)", "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(Method.java:483)", "org.apache.isis.core.metamodel.facets.actions.interaction.ActionInvocationFacetForInteractionAbstract.internalInvoke(ActionInvocationFacetForInteractionAbstract.java:314)", "org.apache.isis.core.metamodel.facets.actions.interaction.ActionInvocationFacetForInteractionAbstract.invoke(ActionInvocationFacetForInteractionAbstract.java:188)", "org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:57)", "org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:54)", "org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:201)", "org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:54)", "org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl.execute(ObjectActionImpl.java:367)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeActionUsingAdapters(DomainResourceHelper.java:266)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeAction(DomainResourceHelper.java:248)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeAction(DomainServiceResourceServerside.java:204)", "sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)", "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(Method.java:483)", "org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)", "org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)", "org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)", "org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:806)", "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)", "org.apache.isis.viewer.restfulobjects.server.webapp.IsisTransactionFilterForRestfulObjects.doFilter(IsisTransactionFilterForRestfulObjects.java:41)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.isis.core.webapp.IsisSessionFilter$SessionState$1.handle(IsisSessionFilter.java:320)", "org.apache.isis.core.webapp.IsisSessionFilter.doFilter(IsisSessionFilter.java:409)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter.doFilter(IsisLogOnExceptionFilter.java:52)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)", "org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)", "org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)", "org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)", "org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)", "org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)", "org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)", "org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)", "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)", "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)", "org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)", "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)", "org.mortbay.jetty.Server.handle(Server.java:326)", "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)", "org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)", "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)", "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)", "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)", "org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)", "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)" ],
  "causedBy" : null
}

I’d like to thank you for taking the time to read through my questions.
I know I have provided a very specific example, however I feel that if a solution is found here, others can more easily adapt that to their own work.

Regards,
Michael

> On 02 Apr 2015, at 2:58 PM, Hiruni Madola <hi...@gmail.com> wrote:
> 
> Hi Dan,
> 
> I got a related question about parameter passing when invoking ISIS Rest
> API.
> 
> 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 a parameter to the REST service when
> invoking via a REST client?
> 
> Regards,
> Hiruni
> 
> On Thu, Apr 2, 2015 at 5:21 PM, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
> 
>> Hi Michael,
>> 
>> The Apache mailing lists don't accept documents, as you've discovered.
>> 
>> Although you can mail me directly if you want [1], I'd rather you simply
>> paste your questions here... that way your questions and hopefully some
>> answers will be available to others in the community to discover/learn
>> from.
>> 
>> ~~~
>> Meanwhile, for some additional ideas on how to use the RO API, take a look
>> at our (incomplete) TCK tests [2].
>> 
>> I'm also aware of this bespoke Angular app [3] that's being written as a
>> front-end to this Isis back-end [4]; might give you some ideas.
>> 
>> Another option, if the full RO representations are a built overwhelming, is
>> either to configure Isis to provide a simplified representation [5] or you
>> could even use custom representations [6].
>> 
>> HTH
>> Dan
>> 
>> 
>> 
>> 
>> [1] https://github.com/apache/isis/blob/master/core/pom.xml#L201
>> [2]
>> 
>> https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck
>> [3] https://github.com/edge-art/matchingfront
>> [4] https://github.com/johandoornenbal/matching
>> [5]
>> 
>> http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html
>> [6]
>> 
>> http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html
>> 
>> 
>> 
>> 
>> On 2 April 2015 at 12:15, Michael Kyrilov <mi...@ecn.co.za> wrote:
>> 
>>> Hi Dan,
>>> 
>>> I had looked at the Restful Objects document, unfortunately I am still
>>> unsure of how to work with he API.
>>> 
>>> I have prepared a short PDF highlighting what exactly my struggles are.
>>> Unfortunately I don’t seem to be able to send it to you. Every time I
>> try,
>>> I get a failed notice from Mailer-deamon@apache.org <mailto:
>>> Mailer-deamon@apache.org>
>>> Is there any other way I say send you this document?
>>> 
>>> Regards,
>>> Michael
>>> 
>>>> On 02 Apr 2015, at 9:46 AM, Dan Haywood <da...@haywood-associates.co.uk>
>>> wrote:
>>>> 
>>>> Hi Michael,
>>>> Have you taken a look at the Restful Objects spec? That should give
>> you a
>>>> good background so you can start to understand what Isis Rest API is
>>>> surfacing for you.
>>>> 
>>>> Cheers, Dan
>>>> 
>>>> http://restfulobjects.org
>>>> On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:
>>>> 
>>>>> Hi there,
>>>>> 
>>>>> My name is Michael. I have recently been tasked to develop a User
>>>>> Interface on top of an Apache Isis application.
>>>>> Isis was originally chosen due to time constrains for the project,
>> this
>>>>> way the team was able to get a functional UI but remain heavily
>> focused
>>> on
>>>>> implementing the business logic.
>>>>> 
>>>>> Our understanding is that Isis provides a REST API for interacting
>> with
>>>>> the domain model, which sounds ideal for building a User Interface.
>>>>> I have managed to locate an API: http://host:port/restful/
>>>>> 
>>>>> I am having difficulties understanding how to interact with this API.
>>>>> I do see that /services the models we have defined and /domain-types
>>> does
>>>>> much the same.
>>>>> We do have data in the database and the difficulty I am having is
>> that I
>>>>> am unable to get data out of this API and I also don’t see how I can
>>> POST
>>>>> data via the API so that it would be saved in the database.
>>>>> 
>>>>> 
>>>>> I am not sure if I am misunderstanding how this works or if I am
>> trying
>>> to
>>>>> use it inappropriately.
>>>>> 
>>>>> 
>>>>> Thank you
>>>>> Regards,
>>>>> Michael
>>>>> 
>>>>> Michael Kyrilov
>>>>> Mid-Level Developer
>>>>> 
>>>>> 
>>>>> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
>>>>> 
>>>>> Unit 10 Growthpoint Business Park
>>>>> 2 Tonnetti Street, Midrand, 1685
>>>>> Office: +27 10 590 0035
>>>>> Cell: +27 72 634 9687
>>>>> 
>>>>> michael@ecn.co.za
>>>>> www.ecn.co.za<http://www.ecn.co.za/>
>>>>> 
>>>>> 
>>>>> This email is sent subject to the terms and conditions detailed in the
>>>>> ECN Email Disclaimer<
>>>>> 
>>> http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/
>>> 
>>>>> 
>>>>> Disclaimer
>>>>> 
>>>>> The information contained in this communication from the sender is
>>>>> confidential. It is intended solely for use by the recipient and
>> others
>>>>> authorized to receive it.
>>>>> If you are not the recipient, you are hereby notified that any
>>> disclosure,
>>>>> copying, distribution or taking action in relation of the contents of
>>> this
>>>>> information is strictly prohibited and may be unlawful.
>>>>> 
>>>>> This email has been scanned for viruses and malware.
>>> 
>>> Disclaimer
>>> 
>>> The information contained in this communication from the sender is
>>> confidential. It is intended solely for use by the recipient and others
>>> authorized to receive it.
>>> If you are not the recipient, you are hereby notified that any
>> disclosure,
>>> copying, distribution or taking action in relation of the contents of
>> this
>>> information is strictly prohibited and may be unlawful.
>>> 
>>> This email has been scanned for viruses and malware.
>>> 
>> 
> 
> 
> 
> -- 
> Hiru

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. 
If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware.

Re: REST API

Posted by Hiruni Madola <hi...@gmail.com>.
Hi Dan,

I got a related question about parameter passing when invoking ISIS Rest
API.

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 a parameter to the REST service when
invoking via a REST client?

Regards,
Hiruni

On Thu, Apr 2, 2015 at 5:21 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> Hi Michael,
>
> The Apache mailing lists don't accept documents, as you've discovered.
>
> Although you can mail me directly if you want [1], I'd rather you simply
> paste your questions here... that way your questions and hopefully some
> answers will be available to others in the community to discover/learn
> from.
>
> ~~~
> Meanwhile, for some additional ideas on how to use the RO API, take a look
> at our (incomplete) TCK tests [2].
>
> I'm also aware of this bespoke Angular app [3] that's being written as a
> front-end to this Isis back-end [4]; might give you some ideas.
>
> Another option, if the full RO representations are a built overwhelming, is
> either to configure Isis to provide a simplified representation [5] or you
> could even use custom representations [6].
>
> HTH
> Dan
>
>
>
>
> [1] https://github.com/apache/isis/blob/master/core/pom.xml#L201
> [2]
>
> https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck
> [3] https://github.com/edge-art/matchingfront
> [4] https://github.com/johandoornenbal/matching
> [5]
>
> http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html
> [6]
>
> http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html
>
>
>
>
> On 2 April 2015 at 12:15, Michael Kyrilov <mi...@ecn.co.za> wrote:
>
> > Hi Dan,
> >
> > I had looked at the Restful Objects document, unfortunately I am still
> > unsure of how to work with he API.
> >
> > I have prepared a short PDF highlighting what exactly my struggles are.
> > Unfortunately I don’t seem to be able to send it to you. Every time I
> try,
> > I get a failed notice from Mailer-deamon@apache.org <mailto:
> > Mailer-deamon@apache.org>
> > Is there any other way I say send you this document?
> >
> > Regards,
> > Michael
> >
> > > On 02 Apr 2015, at 9:46 AM, Dan Haywood <da...@haywood-associates.co.uk>
> > wrote:
> > >
> > > Hi Michael,
> > > Have you taken a look at the Restful Objects spec? That should give
> you a
> > > good background so you can start to understand what Isis Rest API is
> > > surfacing for you.
> > >
> > > Cheers, Dan
> > >
> > > http://restfulobjects.org
> > > On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:
> > >
> > >> Hi there,
> > >>
> > >> My name is Michael. I have recently been tasked to develop a User
> > >> Interface on top of an Apache Isis application.
> > >> Isis was originally chosen due to time constrains for the project,
> this
> > >> way the team was able to get a functional UI but remain heavily
> focused
> > on
> > >> implementing the business logic.
> > >>
> > >> Our understanding is that Isis provides a REST API for interacting
> with
> > >> the domain model, which sounds ideal for building a User Interface.
> > >> I have managed to locate an API: http://host:port/restful/
> > >>
> > >> I am having difficulties understanding how to interact with this API.
> > >> I do see that /services the models we have defined and /domain-types
> > does
> > >> much the same.
> > >> We do have data in the database and the difficulty I am having is
> that I
> > >> am unable to get data out of this API and I also don’t see how I can
> > POST
> > >> data via the API so that it would be saved in the database.
> > >>
> > >>
> > >> I am not sure if I am misunderstanding how this works or if I am
> trying
> > to
> > >> use it inappropriately.
> > >>
> > >>
> > >> Thank you
> > >> Regards,
> > >> Michael
> > >>
> > >> Michael Kyrilov
> > >> Mid-Level Developer
> > >>
> > >>
> > >> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
> > >>
> > >> Unit 10 Growthpoint Business Park
> > >> 2 Tonnetti Street, Midrand, 1685
> > >> Office: +27 10 590 0035
> > >> Cell: +27 72 634 9687
> > >>
> > >> michael@ecn.co.za
> > >> www.ecn.co.za<http://www.ecn.co.za/>
> > >>
> > >>
> > >> This email is sent subject to the terms and conditions detailed in the
> > >> ECN Email Disclaimer<
> > >>
> > http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/
> >
> > >>
> > >> Disclaimer
> > >>
> > >> The information contained in this communication from the sender is
> > >> confidential. It is intended solely for use by the recipient and
> others
> > >> authorized to receive it.
> > >> If you are not the recipient, you are hereby notified that any
> > disclosure,
> > >> copying, distribution or taking action in relation of the contents of
> > this
> > >> information is strictly prohibited and may be unlawful.
> > >>
> > >> This email has been scanned for viruses and malware.
> >
> > Disclaimer
> >
> > The information contained in this communication from the sender is
> > confidential. It is intended solely for use by the recipient and others
> > authorized to receive it.
> > If you are not the recipient, you are hereby notified that any
> disclosure,
> > copying, distribution or taking action in relation of the contents of
> this
> > information is strictly prohibited and may be unlawful.
> >
> > This email has been scanned for viruses and malware.
> >
>



-- 
Hiru

Re: REST API

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Michael,

The Apache mailing lists don't accept documents, as you've discovered.

Although you can mail me directly if you want [1], I'd rather you simply
paste your questions here... that way your questions and hopefully some
answers will be available to others in the community to discover/learn from.

~~~
Meanwhile, for some additional ideas on how to use the RO API, take a look
at our (incomplete) TCK tests [2].

I'm also aware of this bespoke Angular app [3] that's being written as a
front-end to this Isis back-end [4]; might give you some ideas.

Another option, if the full RO representations are a built overwhelming, is
either to configure Isis to provide a simplified representation [5] or you
could even use custom representations [6].

HTH
Dan




[1] https://github.com/apache/isis/blob/master/core/pom.xml#L201
[2]
https://github.com/apache/isis/tree/master/tck/tck-viewer-restfulobjects/src/test/java/org/apache/isis/viewer/restfulobjects/tck
[3] https://github.com/edge-art/matchingfront
[4] https://github.com/johandoornenbal/matching
[5]
http://isis.apache.org/components/viewers/restfulobjects/simplified-object-representation.html
[6]
http://isis.apache.org/components/viewers/restfulobjects/custom-representations.html




On 2 April 2015 at 12:15, Michael Kyrilov <mi...@ecn.co.za> wrote:

> Hi Dan,
>
> I had looked at the Restful Objects document, unfortunately I am still
> unsure of how to work with he API.
>
> I have prepared a short PDF highlighting what exactly my struggles are.
> Unfortunately I don’t seem to be able to send it to you. Every time I try,
> I get a failed notice from Mailer-deamon@apache.org <mailto:
> Mailer-deamon@apache.org>
> Is there any other way I say send you this document?
>
> Regards,
> Michael
>
> > On 02 Apr 2015, at 9:46 AM, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
> >
> > Hi Michael,
> > Have you taken a look at the Restful Objects spec? That should give you a
> > good background so you can start to understand what Isis Rest API is
> > surfacing for you.
> >
> > Cheers, Dan
> >
> > http://restfulobjects.org
> > On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:
> >
> >> Hi there,
> >>
> >> My name is Michael. I have recently been tasked to develop a User
> >> Interface on top of an Apache Isis application.
> >> Isis was originally chosen due to time constrains for the project, this
> >> way the team was able to get a functional UI but remain heavily focused
> on
> >> implementing the business logic.
> >>
> >> Our understanding is that Isis provides a REST API for interacting with
> >> the domain model, which sounds ideal for building a User Interface.
> >> I have managed to locate an API: http://host:port/restful/
> >>
> >> I am having difficulties understanding how to interact with this API.
> >> I do see that /services the models we have defined and /domain-types
> does
> >> much the same.
> >> We do have data in the database and the difficulty I am having is that I
> >> am unable to get data out of this API and I also don’t see how I can
> POST
> >> data via the API so that it would be saved in the database.
> >>
> >>
> >> I am not sure if I am misunderstanding how this works or if I am trying
> to
> >> use it inappropriately.
> >>
> >>
> >> Thank you
> >> Regards,
> >> Michael
> >>
> >> Michael Kyrilov
> >> Mid-Level Developer
> >>
> >>
> >> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
> >>
> >> Unit 10 Growthpoint Business Park
> >> 2 Tonnetti Street, Midrand, 1685
> >> Office: +27 10 590 0035
> >> Cell: +27 72 634 9687
> >>
> >> michael@ecn.co.za
> >> www.ecn.co.za<http://www.ecn.co.za/>
> >>
> >>
> >> This email is sent subject to the terms and conditions detailed in the
> >> ECN Email Disclaimer<
> >>
> http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/>
> >>
> >> Disclaimer
> >>
> >> The information contained in this communication from the sender is
> >> confidential. It is intended solely for use by the recipient and others
> >> authorized to receive it.
> >> If you are not the recipient, you are hereby notified that any
> disclosure,
> >> copying, distribution or taking action in relation of the contents of
> this
> >> information is strictly prohibited and may be unlawful.
> >>
> >> This email has been scanned for viruses and malware.
>
> Disclaimer
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it.
> If you are not the recipient, you are hereby notified that any disclosure,
> copying, distribution or taking action in relation of the contents of this
> information is strictly prohibited and may be unlawful.
>
> This email has been scanned for viruses and malware.
>

Re: REST API

Posted by Michael Kyrilov <mi...@ecn.co.za>.
Hi Dan,

I had looked at the Restful Objects document, unfortunately I am still unsure of how to work with he API.

I have prepared a short PDF highlighting what exactly my struggles are. Unfortunately I don’t seem to be able to send it to you. Every time I try, I get a failed notice from Mailer-deamon@apache.org <ma...@apache.org>
Is there any other way I say send you this document?

Regards,
Michael

> On 02 Apr 2015, at 9:46 AM, Dan Haywood <da...@haywood-associates.co.uk> wrote:
> 
> Hi Michael,
> Have you taken a look at the Restful Objects spec? That should give you a
> good background so you can start to understand what Isis Rest API is
> surfacing for you.
> 
> Cheers, Dan
> 
> http://restfulobjects.org
> On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:
> 
>> Hi there,
>> 
>> My name is Michael. I have recently been tasked to develop a User
>> Interface on top of an Apache Isis application.
>> Isis was originally chosen due to time constrains for the project, this
>> way the team was able to get a functional UI but remain heavily focused on
>> implementing the business logic.
>> 
>> Our understanding is that Isis provides a REST API for interacting with
>> the domain model, which sounds ideal for building a User Interface.
>> I have managed to locate an API: http://host:port/restful/
>> 
>> I am having difficulties understanding how to interact with this API.
>> I do see that /services the models we have defined and /domain-types does
>> much the same.
>> We do have data in the database and the difficulty I am having is that I
>> am unable to get data out of this API and I also don’t see how I can POST
>> data via the API so that it would be saved in the database.
>> 
>> 
>> I am not sure if I am misunderstanding how this works or if I am trying to
>> use it inappropriately.
>> 
>> 
>> Thank you
>> Regards,
>> Michael
>> 
>> Michael Kyrilov
>> Mid-Level Developer
>> 
>> 
>> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
>> 
>> Unit 10 Growthpoint Business Park
>> 2 Tonnetti Street, Midrand, 1685
>> Office: +27 10 590 0035
>> Cell: +27 72 634 9687
>> 
>> michael@ecn.co.za
>> www.ecn.co.za<http://www.ecn.co.za/>
>> 
>> 
>> This email is sent subject to the terms and conditions detailed in the
>> ECN Email Disclaimer<
>> http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/>
>> 
>> Disclaimer
>> 
>> The information contained in this communication from the sender is
>> confidential. It is intended solely for use by the recipient and others
>> authorized to receive it.
>> If you are not the recipient, you are hereby notified that any disclosure,
>> copying, distribution or taking action in relation of the contents of this
>> information is strictly prohibited and may be unlawful.
>> 
>> This email has been scanned for viruses and malware.

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. 
If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware.

Re: REST API

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Michael,
Have you taken a look at the Restful Objects spec? That should give you a
good background so you can start to understand what Isis Rest API is
surfacing for you.

Cheers, Dan

http://restfulobjects.org
On 2 Apr 2015 08:35, "Michael Kyrilov" <mi...@ecn.co.za> wrote:

> Hi there,
>
> My name is Michael. I have recently been tasked to develop a User
> Interface on top of an Apache Isis application.
> Isis was originally chosen due to time constrains for the project, this
> way the team was able to get a functional UI but remain heavily focused on
> implementing the business logic.
>
> Our understanding is that Isis provides a REST API for interacting with
> the domain model, which sounds ideal for building a User Interface.
> I have managed to locate an API: http://host:port/restful/
>
> I am having difficulties understanding how to interact with this API.
> I do see that /services the models we have defined and /domain-types does
> much the same.
> We do have data in the database and the difficulty I am having is that I
> am unable to get data out of this API and I also don’t see how I can POST
> data via the API so that it would be saved in the database.
>
>
> I am not sure if I am misunderstanding how this works or if I am trying to
> use it inappropriately.
>
>
> Thank you
> Regards,
> Michael
>
> Michael Kyrilov
> Mid-Level Developer
>
>
> [http://static.ecntelecoms.za.net/images/ecn-logo.png]
>
> Unit 10 Growthpoint Business Park
> 2 Tonnetti Street, Midrand, 1685
> Office: +27 10 590 0035
> Cell: +27 72 634 9687
>
> michael@ecn.co.za
> www.ecn.co.za<http://www.ecn.co.za/>
>
>
>  This email is sent subject to the terms and conditions detailed in the
> ECN Email Disclaimer<
> http://www.nashuacommunications.com/disclaimer-and-confidentiality-note/>
>
> Disclaimer
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it.
> If you are not the recipient, you are hereby notified that any disclosure,
> copying, distribution or taking action in relation of the contents of this
> information is strictly prohibited and may be unlawful.
>
> This email has been scanned for viruses and malware.