When a browser makes a request to a server it does in the form of requests formatted by some rules so that the server can understand what resource the browser is asking for.A normal REST http header would look like this :
The response from the server side would look something like :
The Accept request-header field can be used to specify certain media types which are acceptable for the response.If no Accept header field is present, then it is assumed that the client accepts all media types.
The Accept-Charset request-header field can be used to indicate what character sets are acceptable for the response.The special value "*", if present in the Accept-Charset field, matches every character set (including ISO-8859-1) which is not mentioned elsewhere in the Accept-Charset field
The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings that are acceptable in the response.
Accept-Lnguages tells about the language that is preferred in the response of the output.
The Cache-Control general-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. The directives specify behavior intended to prevent caches from adversely interfering with the request or response.
The following Cache-Control response directives allow an origin server to override the default cacheability of a response:
The Connection general-header field allows the sender to specify options that are desired for that particular connection and MUST NOT be communicated by proxies over further connections.
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
The Content-MD5 entity-header field, as defined in RFC 1864 [23], is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body. (Note: a MIC is good for detecting accidental modification of the entity-body in transit, but is not proof against malicious attacks.)
For more headers information check RFC section for HTTP headers.
POST /enlighten/rest HTTP/1.1 Host: api.opencalais.com Content-Type: application/x-www-form-urlencoded Content-Length: length licenseID=string&content=string&/paramsXML=string
The response from the server side would look something like :
HTTP/1.1 200 OK Content-Type: text/xml;charset=utf-8 Content-Length: length string
Parts of the HTTP Request and their Significance
Accept: audio/*; q=0.2, audio/basic
The Accept request-header field can be used to specify certain media types which are acceptable for the response.If no Accept header field is present, then it is assumed that the client accepts all media types.
Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
The Accept-Charset request-header field can be used to indicate what character sets are acceptable for the response.The special value "*", if present in the Accept-Charset field, matches every character set (including ISO-8859-1) which is not mentioned elsewhere in the Accept-Charset field
Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0
The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings that are acceptable in the response.
Accept-Language: da, en-gb;q=0.8, en;q=0.7
Accept-Lnguages tells about the language that is preferred in the response of the output.
Accept-Ranges: bytes
The Accept-Ranges response-header field allows the server to indicate its acceptance of range requests for a resource.This is what the internet download manager looks for to tell whether a particular resource is resumable or not.
age-value = delta-seconds
The Age response-header field conveys the sender's estimate of the
amount of time since the response (or its revalidation) was generated at the origin server. A cached response is "fresh" if its age does not exceed its freshness lifetime.Age values are non-negative decimal integers, representing time in seconds.
Allow: GET, HEAD, PUT
The Allow entity-header field lists the set of methods supported
by the resource identified by the Request-URI. The purpose of this
field is strictly to inform the recipient of valid methods
associated with the resource. An Allow header field MUST be
present in a 405 (Method Not Allowed) response.
Authorization = "Authorization" ":" credentials
A user agent that wishes to authenticate itself with a server--
usually, but not necessarily, after receiving a 401 response--does
so by including an Authorization request-header field with the
request. The Authorization field value consists of credentials
containing the authentication information of the user agent for
the realm of the resource being requested.
Cache-Control = "Cache-Control" ":" 1#cache-directive
The Cache-Control general-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. The directives specify behavior intended to prevent caches from adversely interfering with the request or response.
The following Cache-Control response directives allow an origin server to override the default cacheability of a response:
- public
- Indicates that the response MAY be cached by any cache, even if it would normally be non-cacheable or cacheable only within a non- shared cache. (See also Authorization, section 14.8, for additional details.)
- private
- Indicates that all or part of the response message is intended for a single user and MUST NOT be cached by a shared cache. This allows an origin server to state that the specified parts of the
- response are intended for only one user and are not a valid response for requests by other users. A private (non-shared) cache MAY cache the response.
- Note: This usage of the word private only controls where the response may be cached, and cannot ensure the privacy of the message content.
- no-cache
- If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response to satisfy a subsequent request without successful revalidation with the origin server.
Connection: close
The Connection general-header field allows the sender to specify options that are desired for that particular connection and MUST NOT be communicated by proxies over further connections.
Content-Length: 3495
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
Content-MD5 = "Content-MD5" ":" md5-digest md5-digest = <base64 of 128 bit MD5 digest as per RFC 1864>
The Content-MD5 entity-header field, as defined in RFC 1864 [23], is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body. (Note: a MIC is good for detecting accidental modification of the entity-body in transit, but is not proof against malicious attacks.)
For more headers information check RFC section for HTTP headers.