Navigating OData Feeds

These instructions assume you have already imported the OData module into your PowerShell session and mounted an OData feed. If not, please refer to Importing the Module and Mounting OData Feeds.

You can navigate the OData feed using the same PowerShell cmdlets you use to navigate your filesystem. Specifically, the following provider cmdlets are supported by the OData provider:
  • get-item
  • get-childitem (dir, ls)
  • get-content
  • set-location (cd)
  • get-location ($pwd)

The OData drive exposes feed catalogs, collections, and entities as a hierarchical path structure. The drive root contains the OData feed catalogs, the catalogs contain collections, and the collections contain entities. For example:

c:\> cd netflix:
netflix:\> dir

    Container: OData::http:\\odata.netflix.com\v2\Catalog


           Uri                      Name                    
---------- ---                      ----                    
d  <       http://odata.netflix.... Genres                  
d  <       http://odata.netflix.... Titles                  
d  <       http://odata.netflix.... TitleAudioFormats       
d  <       http://odata.netflix.... TitleAwards             
d  <       http://odata.netflix.... People                  
d  <       http://odata.netflix.... TitleScreenFormats      
d  <       http://odata.netflix.... Languages               

netflix:\> cd genres
netflix:\genres> dir


PSPath        : OData::http:\\odata.netflix.com\v2\Catalog\genres\20th Century Period Pieces
PSParentPath  : OData::http:\\odata.netflix.com\v2\Catalog\genres
PSChildName   : 20th Century Period Pieces
PSDrive       : nf
PSProvider    : OData
PSIsContainer : True
SSItemMode    : d  <      
Uri           : http://odata.netflix.com/v2/Catalog/Genres('20th Century Period Pieces')
Name          : 20th Century Period Pieces

PSPath        : OData::http:\\odata.netflix.com\v2\Catalog\genres\Abs, Glutes,  More
PSParentPath  : OData::http:\\odata.netflix.com\v2\Catalog\genres
PSChildName   : Abs, Glutes,  More
PSDrive       : nf
PSProvider    : OData
PSIsContainer : True
SSItemMode    : d  <      
Uri           : http://odata.netflix.com/v2/Catalog/Genres('Abs, Glutes, & More')
Name          : Abs, Glutes, & More

# ... 

PSPath        : OData::http:\\odata.netflix.com\v2\Catalog\genres\Zombie Movies
PSParentPath  : OData::http:\\odata.netflix.com\v2\Catalog\genres
PSChildName   : Zombie Movies
PSDrive       : nf
PSProvider    : OData
PSIsContainer : True
SSItemMode    : d  <      
Uri           : http://odata.netflix.com/v2/Catalog/Genres('Zombie Movies')
Name          : Zombie Movies

netflix:\genres> cd yoga

In some feeds, the entities may have relationships defined against other collections; in these cases, the entity will contain a child collection for each relationship. For example, each Genre entity in the Netflix OData feed is related to a Titles collection containing the Title entities for the genre:

netflix:\genres\yoga> dir


    Container: OData::http:\\odata.netflix.com\v2\Catalog\genres\yoga


           Uri                      Name                    
---------- ---                      ----                    
d  <       http://odata.netflix.... Titles                  


PS nf:\genres\yoga> cd titles
PS nf:\genres\yoga\titles> dir


PSPath        : OData::http:\\odata.netflix.com\v2\Catalog\genres\yoga\titles\ApLhi
PSParentPath  : OData::http:\\odata.netflix.com\v2\Catalog\genres\yoga\titles
PSChildName   : ApLhi
PSDrive       : nf
PSProvider    : OData
PSIsContainer : True
SSItemMode    : d  <      
Uri           : http://odata.netflix.com/v2/Catalog/Titles('ApLhi')
Name          : ApLhi

PSPath        : OData::http:\\odata.netflix.com\v2\Catalog\genres\yoga\titles\ApQa9
PSParentPath  : OData::http:\\odata.netflix.com\v2\Catalog\genres\yoga\titles
PSChildName   : ApQa9
PSDrive       : nf
PSProvider    : OData
PSIsContainer : True
SSItemMode    : d  <      
Uri           : http://odata.netflix.com/v2/Catalog/Titles('ApQa9')
Name          : ApQa9
#...

Last edited Jan 27, 2012 at 8:57 PM by beefarino, version 1

Comments

No comments yet.