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 6028525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:45:10+00:00 2026-05-23T04:45:10+00:00

Assume I have a RESTful web service, which holds information about an object that

  • 0

Assume I have a RESTful web service, which holds information about an object that can be accessed at an url like http://example.com/myobject. I would like to be able to retrieve this information in two formats: firstly, the XML-formatted plain data, and secondly, as a full HTML page, which may also include a javascript interface to change the object and PUT it back with AJAX.

What is the canonical way to achieve this? Should I publish my object at two different urls like http://example.com/myobject?format=xml and …format=html? (Are there better ways than using a query string to distinguish the URLS here?) Or is it sensible to send something like multipart MIME data and can I rely on browsers being able to extract the HTML part? Or is there some HTTP header field in the request I could use?

(With PUT or POST requests sent in different formats, it is much easier as the server can check the format and parse it accordingly.)

  • 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-23T04:45:10+00:00Added an answer on May 23, 2026 at 4:45 am

    You could alternatively use content negotiation instead of querystring parameters. In a nutshell, the client sends the acceptable media types via the Accept header in the request (e.g. “application/xml, text/html;q=0.9”), and the server analyzes this and replies with the client-preferred media type (this process is called server-driven negotiation)

    When doing server-driven negotiation, the response should contain a Vary header indicating what request header was used in the negotiation

    Keep in mind that for this to work the client must send an appropriate Accept header.

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

Sidebar

Related Questions

I have a wcf restful service with a operation contract that contains two values
I'm building a RESTful web service that has the usual flavor of CRUD operations
assume I have this string : How can I convert it to DateTimeOffset object
Assume I have an enumerable object enum and now I want to get the
Assume you have 3 given tasks. You can run them either using process or
Assume I have a set of numbers like 1,2,3,4,5,6,7 input as a single String
Assume i have the following hrefs: .... href=http://localhost/centboox/usedtextbooks/desc/30 .... I would like to through
Assume I have a code like this: @autoreleasepool { for(int i = 0; i
Assume I have an array $arr. It's possible that it has an element with
Assume I have a normal SQL procedure which has a few arguments. During debugging

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.