datasystem metadata from NAR webAPI server


image

 

THe NAR webAPI server, a node.js package and bootstrap fileset, can be made to do something using the following first test harness:

 

1. run the node.js server and mongodb instances, per previous research notes.

2. create a fiddler request, in the compose tool, that will have fiddler talk to the http://localhost:42999/DataSystem.svc endpoint

3. use basic authentication settings (only), where the username and password are both “admin”, i.e.  ‘Authorization: Basic YWRtaW46YWRtaW4=’

image

4. add a querystring parameter, to denote a query that seeks metadata: http://localhost:42999/DataSystem.svc/?DataSystem

 

the result is a first stream, that shows we have something working!

For the request

GET http://localhost:42999/DataSystem.svc/?DataSystem HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: en-US,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: localhost:42999
DNT: 1
Authorization: Basic YWRtaW46YWRtaW4=
Connection: Keep-Alive

we get response body of

<?xml version=”1.0″ encoding=”utf-8″?>

<feed xml:base=”http://localhost:42999/DataSystem.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://localhost:42999/DataSystem.svc</id>
  <title type=”text”>DataSystem</title>
  <updated>2014-09-01T02:08:32.000Z</updated>
  <link rel=”self” title=”DataSystem” href=”DataSystem” />
  <entry>
    <id>http://localhost:42999/DataSystem.svc/DataSystem(‘RESO API Server’)</id>
    <category term=”RESO.OData.Transport.DataSystem” scheme=”http://schemas.microsoft.com/ado/2007/08/dataservices/scheme” />
    <link rel=”edit” title=”DataSystem” href=”DataSystem(‘RESO API Server’)” />
    <title>Data Services for RESO API Server</title>
    <updated>2014-09-01T02:08:32.000Z</updated>
    <author>
      <name>Center for REALTOR Technology</name>
    </author>
    <content type=”application/xml”>
      <m:properties>
        <d:Name>RESO API Server</d:Name>
        <d:ServiceURI>http://localhost:42999/DataSystem.svc</d:ServiceURI>
        <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:23:47.006Z</d:DateTimeStamp>
        <d:TransportVersion>0.9</d:TransportVersion>
        <d:Resources m:type=”Collection(RESO.OData.Transport.Resource)”>
          <d:element>
            <d:Name>Property</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard Property Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>Member</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard Member Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>Office</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard Office Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>Contact</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard Contact Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>Media</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard Media Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>History</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard History Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>SavedSearch</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard SavedSearch Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>OpenHouse</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard OpenHouse Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>Green</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard Green Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>Room</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard Room Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>UnitType</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard UnitType Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>OtherPhone</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard OtherPhone Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>SocialMedia</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard SocialMedia Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>OfficeUrlType</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard OfficeUrlType Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
          <d:element>
            <d:Name>UserDefinedField</d:Name>
            <d:ServiceURI>http://localhost:42999/listing.svc</d:ServiceURI>
            <d:Description>RESO Standard UserDefinedField Resource</d:Description>
            <d:DateTimeStamp m:type=”Edm.DateTime”>2014-09-02T18:16:34.949Z</d:DateTimeStamp>
            <d:TimeZoneOffset m:type=”Edm.Int32″>-7</d:TimeZoneOffset>
            <d:Localizations m:type=”Collection(RESO.OData.Transport.Localization)” />
          </d:element>
        </d:Resources>
        <d:ID>RESO API Server</d:ID>
      </m:properties>
    </content>
  </entry>
</feed>

 

A quick look at the javascript code generating this response body shows

image

that the xml is essentially canned, and the resource classes are programmed in ram (and are not obtained from a db).

 

Fro the data dictionary package, we see the basic model being setup, with 15 entities and the associated entitycontext:

 

image

 

from this, evidently, we see an enumerator run over the $data and create a resources definition set – for use in configuring the core server’s resourceList and index list (inferred from the metadata and entityset declarations):

 

image

 

So, from the metadata jaydata declarations, we get resourcelists and indexes, that are passed to the callback classes that are attached to the listing.svc and dataservice.svc routes:

image

End.

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in odata. Bookmark the permalink.