I am new to REST and just started reading some tutorials.
One thing that really confuses me is: what comes in txt/xml/json form: the resources or the resource representations? Must be the latter, right? Since resources can be a video, audio or other MIME types.
Take the example below. Let's say I am given a description like 'a RESTful service where User is a resource which is represented using the following XML format':
<user>
<id>1</id>
<name>Mahesh</name>
<profession>Teacher</profession>
</user>
or JSON format:
{
"id":1,
"name":"Mahesh",
"profession":"Teacher"
}
Then, when I use HTTP GET to access the resource, what data do I actually get back? Do I get '1, Mahesh, Teacher' since this is the real data excluding the format, or do I get the whole xml or json 'object' that contains both the data and the data representation?
What if User has an image property? What kind of 'package' and in which form will HTTP deliver it to me: the image itself or a link to the image?
EDIT
Another example here:
Here should I understand that the returned resource itself is an XML file, or the resource is NOT an XML file, but some data that's embedded in XML resource representation is?
And what if the resource I want contains images, videos, etc.? Those are not text data that can be embedded in XML or JSON format--in that case, what do I get?
See Question&Answers more detail:os