Shuvayatra / migration-web

0 stars 2 forks source link

Add rss function to https://api.shuvayatra.org/api/posts #11

Closed tyohan closed 8 years ago

tyohan commented 8 years ago

Hi @prashantsh

Can you make this API endpoint also return XML RSS feed if we pass param type=rss.

mojbenzcar commented 8 years ago

@tyohan can you provide the example of XML RSS feed

tyohan commented 8 years ago

@mojbenzcar please take a look here https://validator.w3.org/feed/docs/rss2.html or http://www.tutorialspoint.com/rss/rss2.0-tag-syntax.htm for standard but we also want to extend the item field to include feature image or other meta data that we have. So may be you can extend it with this namespace on RSS http://www.disobey.com/detergent/2002/extendingrss2/

mojbenzcar commented 8 years ago

@tyohan i have implemented rss feed in Here but i am a bit confused extending rss 2 can you help me on this?

tyohan commented 8 years ago

@mojbenzcar can you explain more? I can't do any code this week because i will be on trip. But i can assist you if you have questions.

mojbenzcar commented 8 years ago

@tyohan i have implemented the standard rss feed but having problem add the custom field as you mentioned in last part we also want to extend the item field to include feature image or other meta data that we have. So may be you can extend it with this namespace on RSS http://www.disobey.com/detergent/2002/extendingrss2/. And i am confused how to implement the workspace like xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:webfeeds="http://webfeeds.org/rss/1.0" xmlns:media="http://search.yahoo.com/mrss/" with laravel .

tyohan commented 8 years ago

@mojbenzcar check the field on JSON data then make sure you include it all. But for extra field that not part of RSS standard you can put it with namespace like <sy:feature_image></sy:feature_image> <sy:audio_url></sy:audio_url>

Then at top you can put namespace like this <?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:sy="http://shuvayatra.org/doc/rss/">

The namespace that you include must be include other namespace too like atom so the rss tag at the top suppose to be like this <rss xmlns:sy="http://shuvayatra.org/doc/rss/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">

If you see the different with current xml, I just change the xmlns:content to sy: because we don't use content inside our item.

mojbenzcar commented 8 years ago

@tyohan please check here

tyohan commented 8 years ago

@mojbenzcar looks good for me, you only need to remove xmlns:content="http://purl.org/rss/1.0/modules/content/" since we don't use content:

tyohan commented 8 years ago

@mojbenzcar may be you wanna also check some recommendation from https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fapi.shuvayatra.org%2Fapi%2Fposts%3Ftype%3Dxml