MRD
Mezeo
Documentation
Examples
SDKs
Forum
Mezeo Ready Developer Center
September 09, 2010, 10:16:26 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Mezeo Ready Developer Center
>
Development
>
Getting Started
>
Walk the object tree for a user
Pages: [
1
]
« previous
next »
Print
Author
Topic: Walk the object tree for a user (Read 76 times)
jguthrie
Mezeo Employee
Newbie
Posts: 1
Walk the object tree for a user
«
on:
July 12, 2010, 01:11:01 PM »
Version 2 of the Mezeo API has a feature called "discoverability". What that means is that the only URL you need to know is the root one for the API. All other URL's are embedded in links. One thing this gives is the ability to visit all of the nodes for a given user by starting at the root and simply visiting all the links pointed to by the root and then recursively fetching URL's in the documents fetched.
I've attached a simple bash script that does this for the specified user. The script uses curl to fetch a URL and an XML application called XMLStarlet to process the data as retrieved. The script would be straightforward, but for two things. First, sometimes the links are to things that are not XML documents. For example, file data isn't necessarily XML, neither are the thumbnail images associated with a file. Trying to pass non XML data to XMLStarlet generates errors, so I check the first character of the document and don't attempt to parse the data if it isn't the less than character which XML starts with. Also, some of the links contain links to parts of the tree toward the root. Since the document graph isn't acyclic, I need to be careful to exclude any link to a parent before visiting a link.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Support and Questions
-----------------------------
=> General Discussion
-----------------------------
Development
-----------------------------
=> SDK Related
=> Getting Started
=> REST API
=> Interoperability API
Loading...