• Post Reply Bookmark Topic Watch Topic
  • New Topic

RESTful service - standard output elements, structure ?  RSS feed

 
Mag Wells
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a bit confused about what standard restful service call output is ? I mean for example, my current web service,



This looks pretty ok. But what I am missing is seems the (error)messages from the server, may be the resultset size and things like that. I really have no clue what all addons like these should be included.

Any pointers/samples would be a great help. Also an idea about the gnrl class heirarchy for this to achieve.

-muncher
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no standard of what a REST response looks like. An error message would generally only be returned if there is an error, not if there are results like in your example. If you want metadata, how about a response like this:
 
Mag Wells
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, I guess metadata is the right word. Thanks.

Now there are couple of questsions-
1. What would the general metadata look like ?
2. How do I embed that metadata of every response.

Bit of clarification on #2.
I have java objects say for example Book. My spring framework serializes it and converts it to <book> ..... </book>
set of books would be returned as List.
That is <list> <book>..</book><book>..</book><book>..</book><book>..</book></list>
so do I create a new class metadata and make every other class inherit that ?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Since a response can contain ANY kind of content - XML, binary, whatever, there is no general content metadata.
2. Instead, use the HTTP headers to communicate additional information, thats the whole point of REST, to use the existing HTTP protocol.

For example your response headers should use the correct response code and include a content type and length.

Wikipedial article on response codes

Wikipedial summary of HTTP request and response headers.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!