500px 中文文档教程
node-500px
此插件是 500px.com API 的包装器。 要详细了解 API 提供的内容,请访问 developer.500px.com。
Install
最简单的方法是通过 npm 安装:
npm install 500px
当然你也可以通过 git clone 或通过上面的链接下载 .zip 或 .tar.gz。
Getting started
将模块包含在您的项目中并对其进行初始化。 重要:使用 500px 提供的消费者密钥,而不是 JavaScript SDK 密钥,因为它们是不同的!
var API500px = require('500px'),
api500px = new API500px(consumer_key);
现在您已准备好调用 500px.com API!
GET photos
要检索照片,只需执行以下操作:
api500px.photos.getPopular({'sort': 'created_at', 'rpp': '100'}, function(error, results) {
if (error) {
// Error!
return;
}
// Do something
});
选择获取照片的功能:
getById (photo_id, arguments, callback)
getByUsername (username, arguments, callback)
getByUserId (user_id, arguments, callback)
getFavoritesByUsername (username, arguments, callback)
getFavoritesByUserId (user_id, arguments, callback)
getFriendsByUsername (username, arguments, callback)
getFriendsByUserId (user_id, arguments, callback)
getPopular (arguments, callback)
getUpcoming (arguments, callback)
getEditorsChoice (arguments, callback)
getFreshToday (arguments, callback)
getFreshYesterday (arguments, callback)
getFreshWeek (arguments, callback)
searchByTag (tag, arguments, callback)
searchByTerm (term, arguments, callback)
searchByGeo (geo, arguments, callback)
有关可能参数的更多信息,请查看 500px.com photos API
GET users
要检索用户,只需执行以下操作:
api500px.users.getById(1234, function(error, results) {
if (error) {
// Error!
return;
}
// Do something
});
选择获取用户的功能:
getById (id, callback)
getByName (username, callback)
getByEmail (email, callback)
getFriendsById (id, arguments, callback)
有关可能参数的更多信息,请查看 500px.com 用户 API
GET blogs
要检索博客,只需执行以下操作:
api500px.blogs.getFresh({rpp: 50}, function(error, results) {
if (error) {
// Error!
return;
}
// Do something
});
选择获取博客的功能:
getById (id, arguments, callback)
getCommentsById (id, arguments, callback)
getFresh (arguments, callback)
getByUsername (username, arguments, callback)
getByUserId (user_id, arguments, callback)
有关可能参数的更多信息,请查看 < a href="http://developer.500px.com/docs/blogs-index">500px.com 博客 API
LICENSE
(MIT 许可证)
版权所有 (c) 2011 Robert Katzki robert@katzki.de
特此免费授予任何获得许可的人 此软件和相关文档文件的副本( “软件”),不受限制地处理软件,包括 但不限于使用、复制、修改、合并、发布、 分发、再许可和/或出售软件的副本,以及 允许向其提供软件的人这样做,但须遵守 下列条件:
上述版权声明和本许可声明应 包含在软件的所有副本或重要部分中。
本软件“按原样”提供,不提供任何形式的保证, 明示或暗示的,包括但不限于 适销性、特定用途的适用性和 非侵权。 在任何情况下,作者或版权持有人均不得 对任何索赔、损害或其他责任负责,无论是在诉讼中 合同、侵权行为或其他由其引起、由其引起或与之相关的 与软件或软件的使用或其他交易。
node-500px
This plugin is a wrapper for the API of 500px.com. To get more details on what the API offers, go to developer.500px.com.
Install
The easiest way is to install through npm:
npm install 500px
Of course you can also clone via git or download the .zip or .tar.gz via the links above.
Getting started
Include the module in your project and initialize it. Important: Use the consumer key provided by 500px, not the JavaScript SDK key, as that is different!
var API500px = require('500px'),
api500px = new API500px(consumer_key);
Now you are ready to do some calls to the 500px.com API!
GET photos
To retrieve photos, just do the following:
api500px.photos.getPopular({'sort': 'created_at', 'rpp': '100'}, function(error, results) {
if (error) {
// Error!
return;
}
// Do something
});
Choose on of the funtions to get photos:
getById (photo_id, arguments, callback)
getByUsername (username, arguments, callback)
getByUserId (user_id, arguments, callback)
getFavoritesByUsername (username, arguments, callback)
getFavoritesByUserId (user_id, arguments, callback)
getFriendsByUsername (username, arguments, callback)
getFriendsByUserId (user_id, arguments, callback)
getPopular (arguments, callback)
getUpcoming (arguments, callback)
getEditorsChoice (arguments, callback)
getFreshToday (arguments, callback)
getFreshYesterday (arguments, callback)
getFreshWeek (arguments, callback)
searchByTag (tag, arguments, callback)
searchByTerm (term, arguments, callback)
searchByGeo (geo, arguments, callback)
For more information on the possible arguments, please check the 500px.com photos API
GET users
To retrieve users, just do the following:
api500px.users.getById(1234, function(error, results) {
if (error) {
// Error!
return;
}
// Do something
});
Choose on of the funtions to get users:
getById (id, callback)
getByName (username, callback)
getByEmail (email, callback)
getFriendsById (id, arguments, callback)
For more information on the possible arguments, please check the 500px.com users API
GET blogs
To retrieve blogs, just do the following:
api500px.blogs.getFresh({rpp: 50}, function(error, results) {
if (error) {
// Error!
return;
}
// Do something
});
Choose on of the funtions to get blogs:
getById (id, arguments, callback)
getCommentsById (id, arguments, callback)
getFresh (arguments, callback)
getByUsername (username, arguments, callback)
getByUserId (user_id, arguments, callback)
For more information on the possible arguments, please check the 500px.com blogs API
LICENSE
(MIT License)
Copyright (c) 2011 Robert Katzki robert@katzki.de
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.