Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 451915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:01:14+00:00 2026-05-12T22:01:14+00:00

The Sun Cloud API at http://kenai.com/projects/suncloudapis/pages/Home is a good example to follow for a

  • 0

The Sun Cloud API at http://kenai.com/projects/suncloudapis/pages/Home is a good example to follow for a RESTful API. True to RESTful principles, when you GET a resource you get no more nor less than a representation of that resource.

The Content-Type header in the response tells you exactly what the type of that resource is, for example application/vnd.com.sun.cloud.Snapshot+json. Sun has registered these mimetypes with the IANA.

How practical is this in general currently? Most API’s I have seen have used the Content-Type of “application/json”. This tells you that the response is JSON but nothing more about it. You have to have something in the JSON object, like a “type” property, to know what it is.

I’m designing a RESTful API (which will not be made public, therefore I wouldn’t be registering mimetypes). I have been using RESTEasy and I find that even if I specify a complete mimetype, the Content-Type in the response header will be exactly what the Accept request header specified. If the request asks for “application/*+json” by default the response header will have “application/*+json”. I can probably fix this by changing the header before the response goes out, but should I try to do that? Or should the response have a wildcard just like the request did?

Or should I just serve up “application/json” like most APIs seem to do?

Additional thoughts added later:

Another way of stating the question is: Should I use HTTP as the protocol, or should I use HTTP only as a transport mechanism to wrap my own protocol?

To use HTTP as the protocol, the entity body of the response contains the representation of the object requested (or the representation of an error message object), the “Content-Type” header contains the exact type of the object, and the “Status” header contains a success or error code.

To use HTTP as merely a transport mechanism, the “Status” header is always set to 200 OK, the “Content-Type” is something generic like “application/json”, and the entity body contains something that itself has an object, an object type, an error code and whatever else you want. If your own protocol is RESTful, then the whole scheme is RESTful. (HTTP is a RESTful protocol but not the only possible one.)

Your own protocol will be opaque to all the transport layers. If you use HTTP as the protocol, all the transport layers will understand it and may do things you don’t want; for instance a browser will intercept a “401 Unauthorized” response and put up a login dialog, even if you want to handle it yourself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:01:14+00:00Added an answer on May 12, 2026 at 10:01 pm

    Or should I just serve up “application/json” like most APIs seem to do?

    I don’t think so.

    A media type is the only point of coupling between your RESTful web application and the clients that use it. The documentation of your media types is the documentation of your API. Your media types are the contract between your clients and your application. Eliminate the specific media type and you eliminate an important element that makes REST workable.

    Sun has registered these mimetypes with the IANA.

    Couldn’t find any mention of that here. AFAIK, there is no requirement to actually register your custom media type with the IANA. The convention seems to be to use the inverted domain notation of application/vnd.com.example.app.foo+json, which prevents namespace conflicts. If and when your media type becomes stable and public, it might be a good idea, but there’s no requirement. Could be wrong on this, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From http://java.sun.com/developer/technicalArticles/J2SE/security/#3 : Note: These two system properties are ignored when applications run on
According to http://java.sun.com/products/javamail/javadocs/javax/mail/FetchProfile.html , Message[] msgs = folder.getMessages(); FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.ENVELOPE);
I have been using com.sun.org.apache.xpath.internal.XPathAPI for some time and it seems to work ok.
import sun.net.www.protocol.jar.Handler causes the following warning: sun.net.www.protocol.jar.Handler is Sun proprietary API and may be
I'm using com.sun.net.httpserver.HttpServer in my project. However, it seems that the server leaks connections
Using the com.sun.jndi.fscontext.RefFSContextFactory file based JNDI context factory and it seems to only allow
Using com.sun.codemodel , I would like to generate a generic LinkedList field. I can
Date: Sun, 31 Oct 2010 21:12:24 +0600 From: jim@google.com X-Priority: 3 (Normal) Message-ID: <1176875350.20101031211224@goole.com>
The Sun Documentation for DataInput.skipBytes states that it makes an attempt to skip over
Should I stick with Sun's Java code conventions for PHP code?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.