问题
I have recently started using Telescope (http://www.telesc.pe/) from the creators of Meteor for a small project. I am just starting to learn about Meteor, and since essentially database / web server and application stack are collapsed into one framework, I'm wondering what the most efficient way is for me to have an external application (for ex: python script) post and access posts/comments from Telescope. Essentially, I'd like a bot to be able to:
- Create posts
- Add comments to posts
- Pull back a list of posts
Ideally I'd like to access this via HTTP requests (get/post/etc), but am not sure how to do this within telescope / meteor or possibly DB queries. Any help (such as an example API call to create a new post) or the appropriate way to do this using Meteor would be much appreciated!
回答1:
From the documentation it doesn't look like Telescope has a webservice API and there aren't any plans for it on the roadmap either.
Luckily meteor has a packaging system, which telescope already uses a lot. So you could make a meteor package that hooks into telescope and exposes webservices for the functionality you described.
Meteorpedia has a good article on how to create rest api's in meteor: here
回答2:
Telescope has a basic API. You can see a sample response here... http://meta.telesc.pe/api
And here's the package that makes that happen.
https://github.com/TelescopeJS/Telescope/tree/master/packages/telescope-api
You could copy and extend that package to accomplish whatever you need.
来源:https://stackoverflow.com/questions/25430468/meteor-js-how-to-access-posts-programmatically-in-telescope-app