Ignore all of this. I have left if here just as historical record of my cluelessness.I have the beginning of the Restful server setup. Right now it is returning way to many fields and I am trying to cut them down. I am posting this to give other developers a peak on how it is setup right now. I hope to get rid of some steps in the future, but I cannot figure out how to include a search for the <tid> field. tid stands for taxonomy term, which is what durpal uses to link content. You have to watch out cause a resouces will have a <tid> field for each taxonomy term used in the content.
As you will see at the bottom of this post, I cannot figure out how to just get the media_resources for an individual plugin, right now each media_resource needs to be downloaded and checked to see if it requires the plugin. This is one thing I am working on figuring out. To be able to get just the media_resources for the selected plugin.
This one should give you a list of all the plugins.
- Code:
http://www.serviidb.com/rest/node?fields=title¶meters[type]=plugin
which gives the information in this format.
- Code:
<?xml version="1.0" encoding="UTF-8"?>
-<result is_array="true">-<item><title>SHOUTcast</title><uri>http://www.serviidb.com/rest/node/</uri></item>-<item><title>Trailer Addict</title><uri>http://www.serviidb.com/rest/node/</uri></item>-<item><title>Hulu (US)</title><uri>http://www.serviidb.com/rest/node/</uri></item>
You can see the different plugin titles between the <title> </title> field.
If you use that title in the following to get the information about the plugin.
- Code:
http://www.serviidb.com/rest/node?parameters[title]=shoutcast
Which gives you the following.
- Code:
<?xml version="1.0" encoding="utf-8"?>
<result is_array="true"><item><nid>106</nid><vid>123</vid><type>plugin</type><language>en</language><title>SHOUTcast</title><uid>34</uid><status>1</status><created>1330234373</created><changed>1330234373</changed><comment>2</comment><promote>1</promote><sticky>0</sticky><tnid>0</tnid><translate>0</translate><uri>http://www.serviidb.com/rest/node/106</uri></item></result>
If you then take the <uri> </uri> field and use it like below.
- Code:
http://serviidb.com/rest/node/106.xml
you get the following
- Code:
<?xml version="1.0" encoding="utf-8"?>
<result><vid>123</vid><uid>34</uid><title>SHOUTcast</title><log></log><status>1</status><comment>2</comment><promote>1</promote><sticky>0</sticky><ds_switch></ds_switch><nid>106</nid><type>plugin</type><language>en</language><created>1330234373</created><changed>1330234373</changed><tnid>0</tnid><translate>0</translate><revision_timestamp>1330234373</revision_timestamp><revision_uid>34</revision_uid><field_name><und is_array="true"><item><fid>32</fid><display>1</display><description></description><uid>34</uid><filename>shoutcast.groovy</filename><uri>public://Create Plugin/shoutcast.groovy</uri><filemime>application/octet-stream</filemime><filesize>2943</filesize><status>1</status><timestamp>1330234373</timestamp><rdf_mapping/></item></und></field_name><field_revision><und is_array="true"><item><value>1</value></item></und></field_revision><field_body/><field_plugins><und is_array="true"><item><tid>60</tid></item></und></field_plugins><rdf_mapping><rdftype is_array="true"><item>sioc:Item</item><item>foaf:Document</item></rdftype><title><predicates is_array="true"><item>dc:title</item></predicates></title><created><predicates is_array="true"><item>dc:date</item><item>dc:created</item></predicates><datatype>xsd:dateTime</datatype><callback>date_iso8601</callback></created><changed><predicates is_array="true"><item>dc:modified</item></predicates><datatype>xsd:dateTime</datatype><callback>date_iso8601</callback></changed><body><predicates is_array="true"><item>content:encoded</item></predicates></body><uid><predicates is_array="true"><item>sioc:has_creator</item></predicates><type>rel</type></uid><name><predicates is_array="true"><item>foaf:name</item></predicates></name><comment_count><predicates is_array="true"><item>sioc:num_replies</item></predicates><datatype>xsd:integer</datatype></comment_count><last_activity><predicates is_array="true"><item>sioc:last_activity_date</item></predicates><datatype>xsd:dateTime</datatype><callback>date_iso8601</callback></last_activity></rdf_mapping><cid>0</cid><last_comment_timestamp>1330234373</last_comment_timestamp><last_comment_name/><last_comment_uid>34</last_comment_uid><comment_count>0</comment_count><name>Xmantium</name><picture>0</picture><data>a:1:{s:7:"contact";i:1;}</data></result>
If you use <filename>shoutcast.groovy</filename> as below you can get the file information.
- Code:
http://www.serviidb.com/rest/file?parameters[filename]=shoutcast.groovy
This will return the following.
- Code:
<?xml version="1.0" encoding="utf-8"?>
<result is_array="true"><item><fid>32</fid><uid>34</uid><filename>shoutcast.groovy</filename><uri>http://www.serviidb.com/rest/file/32</uri><filemime>application/octet-stream</filemime><filesize>2943</filesize><status>1</status><timestamp>1330234373</timestamp></item></result>
if you use <uri>http://www.serviidb.com/rest/file/32</uri> as below you can get the download link to the file.
- Code:
http://www.serviidb.com/rest/file/32.xml
which gives the following.
- Code:
<?xml version="1.0" encoding="utf-8"?>
<result><fid>32</fid><uid>34</uid><filename>shoutcast.groovy</filename><uri>public://Create Plugin/shoutcast.groovy</uri><filemime>application/octet-stream</filemime><filesize>2943</filesize><status>1</status><timestamp>1330234373</timestamp><rdf_mapping/><uri_full>http://www.serviidb.com/sites/default/files/Create%20Plugin/shoutcast.groovy</uri_full><target_uri>Create Plugin/shoutcast.groovy</target_uri><file>aW1wb3J0IGdyb292eS5qc29uLkpzb25TbHVycGVyDQoNCmltcG9ydCBncm9vdnkuanNvbi5Kc29uU2x1cnBlcg0KDQppbXBvcnQgb3JnLnNlcnZpaW8ubGlicmFyeS5tZXRhZGF0YS4qDQppbXBvcnQgb3JnLnNlcnZpaW8ubGlicmFyeS5vbmxpbmUuKg0KaW1wb3J0IG9yZy5zZXJ2aWlvLnV0aWwuKg0KDQovKioNCiAqIFdlYlJlc291cmNlIGV4dHJhY3RvciBwbHVnaW4gZm9yIHNob3V0Y2FzdC5jb20uDQogKiANCiAqIEBhdXRob3IgamhiNTANCiAqDQogKi8NCmNsYXNzIFNob3V0Y2FzdCBleHRlbmRzIFdlYlJlc291cmNlVXJsRXh0cmFjdG9yIHsNCgkNCglmaW5hbCBWQUxJRF9GRUVEX1VSTCA9ICdeKD86aHR0cD86Ly8pPyg/Ond3d1xcLik/c2hvdXRjYXN0XFwuY29tLycNCgkNCglTdHJpbmcgZ2V0RXh0cmFjdG9yTmFtZSgpIHsNCgkJcmV0dXJuICdTaG91dGNhc3QnDQoJfQ0KCQ0KCWJvb2xlYW4gZXh0cmFjdG9yTWF0Y2hlcyhVUkwgZmVlZFVybCkgew0KCQlyZXR1cm4gZmVlZFVybCA9PX4gVkFMSURfRkVFRF9VUkwNCgl9DQoJDQoJV2ViUmVzb3VyY2VDb250YWluZXIgZXh0cmFjdEl0ZW1zKFVSTCByZXNvdXJjZVVybCwgaW50IG1heEl0ZW1zKSB7DQoJCVN0cmluZyBodG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ua01hdGNoZXJbMF1bMV0udHJpbSgpDQoJCXByaW50bG4gInN0cmVhbUxpbmsgPSAkc3RyZWFtTGluayINCg0KCQlyZXR1cm4gbmV3IENvbnRlbnRVUkxDb250YWluZXIoZmlsZVR5cGU6IE1lZGlhRmlsZVR5cGUuQVVESU8sIGNvbnRlbnRVcmw6IHN0cmVhbUxpbmssIGxpdmU6IHRydWUpDQoJfQ0KCQ0KCQ0KCXN0YXRpYyB2b2lkIG1haW4oYXJncykgew0KCQkvLyB0aGlzIGlzIGp1c3QgdG8gdGVzdA0KCQlTaG91dGNhc3QgZXh0cmFjdG9yID0gbmV3IFNob3V0Y2FzdCgpDQoJCQkJDQoJCWFzc2VydCBleHRyYWN0b3IuZXh0cmFjdG9yTWF0Y2hlcyggbmV3IFVSTCgiaHR0cDovL3d3dy5zaG91dGNhc3QuY29tLyIpICkNCgkJYXNzZXJ0ICFleHRyYWN0b3IuZXh0cmFjdG9yTWF0Y2hlcyggbmV3IFVSTCgiaHR0cDovL2dvb2dsZS5jb20vZmVlZHMvYXBpL3N0YW5kYXJkZmVlZHMvdG9wX3JhdGVkP3RpbWU9dG9kYXkiKSApDQoJCQ0KCQlXZWJSZXNvdXJjZUNvbnRhaW5lciBjb250YWluZXIgPSBleHRyYWN0b3IuZXh0cmFjdEl0ZW1zKCBuZXcgVVJMKCJodHRwOi8vd3d3LnNob3V0Y2FzdC5jb20vIiksIC0xKQ0KCQlwcmludGxuIGNvbnRhaW5lcg0KCQkNCgkJQ29udGVudFVSTENvbnRhaW5lciByZXN1bHQgPSBleHRyYWN0b3IuZXh0cmFjdFVybChjb250YWluZXIuZ2V0SXRlbXMoKVszXSwgUHJlZmVycmVkUXVhbGl0eS5NRURJVU0pDQoJCXByaW50IHJlc3VsdA0KCX0gDQp9</file><image_styles/></result>
If you use the <uri_full>http://www.serviidb.com/sites/default/files/Create%20Plugin/shoutcast.groovy</uri_full> from above you can download the file.
- Code:
http://www.serviidb.com/sites/default/files/Create%20Plugin/shoutcast.groovy
OK now we have the plugin downloaded, now we can work on the media_resources
if you use the following you will get all the media_resources in the database. This one should give a big list of all the media resources. (yes resources is spelled wrong, will fix when I figure out how)
- Code:
http://www.serviidb.com/rest/node?parameters[type]=media_recourse
This is the format of the results.
- Code:
<?xml version="1.0" encoding="utf-8"?>
<result is_array="true"><item><nid>101</nid><vid>116</vid><type>media_recourse</type><language>und</language><title>One HD</title><uid>34</uid><status>1</status><created>1330037863</created><changed>1330037863</changed><comment>2</comment><promote>1</promote><sticky>0</sticky><tnid>0</tnid><translate>0</translate><uri>http://www.serviidb.com/rest/node/101</uri></item><item><nid>99</nid><vid>114</vid><type>media_recourse</type><language>und</language><title>HD Sports</title><uid>34</uid><status>1</status><created>1330024899</created><changed>1330024942</changed><comment>2</comment><promote>1</promote><sticky>0</sticky><tnid>0</tnid><translate>0</translate><uri>http://www.serviidb.com/rest/node/99
If you use the <uri>http://www.serviidb.com/rest/node/101</uri> from above you can get the detailed information on the resource.
- Code:
http://www.serviidb.com/rest/node/101.xml
which gives the following information.
- Code:
<?xml version="1.0" encoding="utf-8"?>
<result><vid>116</vid><uid>34</uid><title>One HD</title><log></log><status>1</status><comment>2</comment><promote>1</promote><sticky>0</sticky><ds_switch></ds_switch><nid>101</nid><type>media_recourse</type><language>und</language><created>1330037863</created><changed>1330037863</changed><tnid>0</tnid><translate>0</translate><revision_timestamp>1330037863</revision_timestamp><revision_uid>34</revision_uid><field_media_id><und is_array="true"><item><value>One HD</value><format/><safe_value>One HD</safe_value></item></und></field_media_id><field_url><und is_array="true"><item><value>https://sites.google.com/site/serviiorss/LiveFeeds_One_HD.rss </value><format/><safe_value>https://sites.google.com/site/serviiorss/LiveFeeds_One_HD.rss </safe_value></item></und></field_url><field_language/><field_cateegory><und is_array="true"><item><tid>13</tid></item></und></field_cateegory><field_region/><field_media_source><und is_array="true"><item><tid>5</tid></item></und></field_media_source><field_media_type><und is_array="true"><item><tid>15</tid></item></und></field_media_type><field_rating/><field_reliability/><field_thumbnail/><field_resolution><und is_array="true"><item><tid>25</tid></item></und></field_resolution><field_site_url><und is_array="true"><item><value>http://live.1hd.ro</value><format/><safe_value>http://live.1hd.ro</safe_value></item></und></field_site_url><field_media_description><und is_array="true"><item><value>The On-line Arts and Entertainment Network Featuring Classics, Dance, Jazz, Live, Pop and Rock Channels.</value><format/><safe_value>The On-line Arts and Entertainment Network Featuring Classics, Dance, Jazz, Live, Pop and Rock Channels.</safe_value></item></und></field_media_description><meta_abstract/><meta_keywords/><meta_description/><field_plugin_revision/><field_plugins><und is_array="true"><item><tid>53</tid></item></und></field_plugins><field_pluginname/><rdf_mapping><rdftype is_array="true"><item>sioc:Item</item><item>foaf:Document</item></rdftype><title><predicates is_array="true"><item>dc:title</item></predicates></title><created><predicates is_array="true"><item>dc:date</item><item>dc:created</item></predicates><datatype>xsd:dateTime</datatype><callback>date_iso8601</callback></created><changed><predicates is_array="true"><item>dc:modified</item></predicates><datatype>xsd:dateTime</datatype><callback>date_iso8601</callback></changed><body><predicates is_array="true"><item>content:encoded</item></predicates></body><uid><predicates is_array="true"><item>sioc:has_creator</item></predicates><type>rel</type></uid><name><predicates is_array="true"><item>foaf:name</item></predicates></name><comment_count><predicates is_array="true"><item>sioc:num_replies</item></predicates><datatype>xsd:integer</datatype></comment_count><last_activity><predicates is_array="true"><item>sioc:last_activity_date</item></predicates><datatype>xsd:dateTime</datatype><callback>date_iso8601</callback></last_activity></rdf_mapping><webform><confirmation></confirmation><confirmation_format/><redirect_url><confirmation></redirect_url><teaser>0</teaser><block>0</block><allow_draft>0</allow_draft><auto_save>0</auto_save><submit_notice>1</submit_notice><submit_text></submit_text><submit_limit>-1</submit_limit><submit_interval>-1</submit_interval><total_submit_limit>-1</total_submit_limit><total_submit_interval>-1</total_submit_interval><status>1</status><record_exists></record_exists><roles is_array="true"><item>1</item><item>2</item></roles><emails/><components/></webform><cid>0</cid><last_comment_timestamp>1330037863</last_comment_timestamp><last_comment_name/><last_comment_uid>34</last_comment_uid><comment_count>0</comment_count><name>Xmantium</name><picture>0</picture><data>a:1:{s:7:"contact";i:1;}</data></result>
If you look at the last results you will see the following
- Code:
<field_plugins><und is_array="true"><item><tid>53</tid></item></und></field_plugins>
The above tells that it is a livefeeds
- Code:
<?xml version="1.0" encoding="utf-8"?>
<result is_array="true"><item><tid>53</tid><vid>14</vid><name>LiveFeeds</name><description></description><format>php_code</format><weight>0</weight><language>und</language><i18n_tsid>0</i18n_tsid><uri>http://www.serviidb.com/rest/term/53</uri></item></result>