Skip to content

Instantly share code, notes, and snippets.

@markdstafford
Last active December 16, 2015 15:39
Show Gist options
  • Save markdstafford/5457004 to your computer and use it in GitHub Desktop.
Save markdstafford/5457004 to your computer and use it in GitHub Desktop.
Code for OData 101: What is JSON Light?
{
"odata.metadata":"http://services.odata.org/Experimental/OData/OData.svc/$metadata#ODataDemo.DemoService/Products/@Element",
"ID":0,
"Name":"Bread",
"Description":"Whole grain bread",
"ReleaseDate":"1992-01-01T00:00:00",
"DiscontinuedDate":null,
"Rating":4,
"Price":"2.5"
}
<?xml version="1.0" encoding="utf-8" ?>
<entry xml:base="http://services.odata.org/V3/(S(nlsniide4slrvlulxmx54obs))/OData/OData.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://services.odata.org/V3/(S(nlsniide4slrvlulxmx54obs))/OData/OData.svc/Products(1)</id>
<category term="ODataDemo.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Product" href="Products(1)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=entry" title="Category" href="Products(1)/Category" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(1)/Supplier" />
<title type="text">Milk</title>
<summary type="text">Low fat milk</summary>
<updated>2013-04-25T02:09:06Z</updated>
<author>
<name />
</author>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Category" type="application/xml" title="Category" href="Products(1)/$links/Category" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Supplier" type="application/xml" title="Supplier" href="Products(1)/$links/Supplier" />
<m:action metadata="http://services.odata.org/V3/(S(nlsniide4slrvlulxmx54obs))/OData/OData.svc/$metadata#DemoService.Discount" title="Discount" target="http://services.odata.org/V3/(S(nlsniide4slrvlulxmx54obs))/OData/OData.svc/Products(1)/Discount" />
<content type="application/xml">
<m:properties>
<d:ID m:type="Edm.Int32">1</d:ID>
<d:ReleaseDate m:type="Edm.DateTime">1995-10-01T00:00:00</d:ReleaseDate>
<d:DiscontinuedDate m:null="true" />
<d:Rating m:type="Edm.Int32">3</d:Rating>
<d:Price m:type="Edm.Decimal">3.5</d:Price>
</m:properties>
</content>
</entry>
{
"d":{
"__metadata":{
"id":"http://services.odata.org/Experimental/OData/OData.svc/Products(0)",
"uri":"http://services.odata.org/Experimental/OData/OData.svc/Products(0)",
"type":"ODataDemo.Product",
"properties":{
"Category":{
"associationuri":"http://services.odata.org/Experimental/OData/OData.svc/Products(0)/$links/Category"
},
"Supplier":{
"associationuri":"http://services.odata.org/Experimental/OData/OData.svc/Products(0)/$links/Supplier"
}
}
},
"Category":{
"__deferred":{
"uri":"http://services.odata.org/Experimental/OData/OData.svc/Products(0)/Category"
}
},
"Supplier":{
"__deferred":{
"uri":"http://services.odata.org/Experimental/OData/OData.svc/Products(0)/Supplier"
}
},
"ID":0,
"Name":"Bread",
"Description":"Whole grain bread",
"ReleaseDate":"1992-01-01T00:00:00",
"DiscontinuedDate":null,
"Rating":4,
"Price":"2.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment