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

  • Home
  • SEARCH
  • 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 337885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:22:39+00:00 2026-05-12T10:22:39+00:00

I am designing a REST service that could be used by many types of

  • 0

I am designing a REST service that could be used by many types of clients, most likely .Net, PHP, Flex and JavaScript. I am building the service using WCF and the REST starter kit. One of my main goals is to make it as simple as possible for all those clients to use the API.

Let’s say that the API deals with zoos. When the client creates a new zoo it would be nice if they could pass along the initial set of animals so they only need to make a single call to the API, e.g.

<Zoo>
    <Name>My Zoo</Name>
    <Animals>
        <Snake>
            <Name>Frank</Name>
            <Length>2.5m</Name>
        </Snake>
        <Giraffe>
            <Name>Alfred</Name>
            <Height>10m</Height>
        </Giraffe>
    </Animals>
</Zoo>

I then want to deserialize the XML into C# classes like this:

List<Animal> Animals { get; set; }

class Animal { public string Name { get; set; } }
class Snake : Animal { public float Length { get; set; } }
class Giraffe : Animal { public float Height { get; set; } }

WCF doesn’t like this as it wants the XML formatted like this:

<Zoo xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Name>My Zoo</Name>
    <Animals>
        <Animal i:type="Snake">
            <Name>Frank</Name>
            <Length>2.5m</Name>
        </Animal>
        <Animal i:type="Giraffe">
            <Name>Alfred</Name>
            <Height>10m</Height>
        </Animal>
    </Animals>
</Zoo>

This looks like it is going to be trickier to work with in client without high end tooling support which raises lots of questions:

  • Is there a better design for this API?
  • Is the second format going to be a problem for non-WCF clients?
  • Can I make WCF format this data the first way?
  • Should I use these types of hierarchies in the XML at all?
  • 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-12T10:22:40+00:00Added an answer on May 12, 2026 at 10:22 am

    Your question seems to be both about using WFC for REST and about modeling a concept in REST. I had an idea on your modeling question:

    Is there a better design for this API?

    What about introducing a new resource to model the mass-import of animals? You might call it something like “Shipment”.

    A Shipment might be defined as a list of new animals to be introduced into a Zoo. By exposing Shipment as a first-class resource, you would have the ability to manage them, track which Animal came in on which Shipment (to track down a disease outbreak, for example), and enable Shipments to take place at any time, not just during the creation of a Zoo.

    Also, don’t forget that REST APIs must be hypertext-driven.

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

Sidebar

Related Questions

I'm designing a REST-style API for a service that provides analysis of clinical data.
I'm designing a web service that serves up JSON through a REST API. This
I'm currently designing a service. It is a multi-tier service, that stores data from
I have a Jersey client that is successfully calling a REST service and populating
I'm designing a distributed application that will consist of a variety of REST services.
I am having a bit of difficulty designing a url for a rest service
I'm designing a REST solution for remote communication with a number of servers that
I'm currently designing a REST Http api. (With HATEOAS stuff, to make clients simpler,
I'm designing a REST service and there's a need for a check to see
I am designing a REST service and am trying to weight the pros and

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.