I prefer representation B, for reasons I'll explain below, but first
I'd like to say that what it comes down to, is that it's easier for me
to implement B, but really, that's my problem, not yours :-)
What's most important to me, is that you consistently use the same
representation across all JSON responses. I'd perfectly understand if
you choose to be consistent across JSON and XML.
For my SpokenWord client I use Visual Studio 2008 on a Vista system.
The language is C#. For the RESTful stuff I use the WCF REST Starter
Kit preview 2. The serializer I use is
System.Runtime.Serialization.Json.DataContractJsonSerializer
With representation B, I can do something like this:
public class Collection : IExtensibleDataObject
{
// Lots of other members...
[DataMember(Name = "programs")]
public Programs Programs { get; set; }
public ExtensionDataObject ExtensionData { get; set; }
}
[CollectionDataContract(Name = "programs", ItemName = "program")]
public class Programs : List<Program>
{
}
And so a collection simply contains a list of programs.
With representation A, this doesn't work, because the serializer finds
something else in between the Programs and the Program. I don't know
how to tell the serializer to ignore that. (Of course this may very
well be a consequence my ignorance of these matters; I took this
opportunity to learn about Visual Studio, C#, serialization, JSON and
REST. I'm just a newbie really.) Anyway, for a feed, I now have to do
this to get it to work:
[DataContract(Name = "feed")]
public class Feed : IExtensibleDataObject
{
[DataMember(Name = "programs")]
public FeedPrograms Programs { get; set; }
public ExtensionDataObject ExtensionData { get; set; }
}
[CollectionDataContract(Name = "programs", ItemName = "program")]
public class FeedPrograms : List<InBetweenProgram>
{
}
[DataContract()]
public class InBetweenProgram : IExtensibleDataObject
{
[DataMember(Name = "program")]
public Program Program { get; set; }
public ExtensionDataObject ExtensionData { get; set; }
}
And so a feed contains a list of "InBetweenPrograms", each of which
contains nothing but a program.
But as I said, this really is my problem, not yours. I mostly want
SpokenWord to be consistent.
Thanks, regards, Miel.
> --
>
> You received this message because you are subscribed to the Google Groups
> "SpokenWord.org APIs" group.
> To post to this group, send email to spokenw...@googlegroups.com.
> To unsubscribe from this group, send email to
> spokenword-ap...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/spokenword-api?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "SpokenWord.org APIs" group.
To post to this group, send email to spokenw...@googlegroups.com.
To unsubscribe from this group, send email to spokenword-ap...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spokenword-api?hl=en.
Agree with that.
I have not even looked closely at A versus B, because it just does not
matter too much. You can make parsers for either without much trouble.
Thilo
I use /feed, and I applaud your choice to go with B. I'll be glad to
clean up my code after you made the change.
Thanks, regards,
Miel.
=====
Who is using /feed at this point? I'll check the API logs, but I have a feeling it's only one or two people so far.
IF YOU HAVE A PROBLEM WITH THIS DEPLOYMENT, please let me know ASAP. I can (a) delay the deployment or (b) reconsider the strategy.