APP定位
图片壁纸 采用Splash网站,提供的后台支持,开发的第三方图片壁纸客户端。
API 说明
-
地址
网站的baseUrl: https://api.unsplash.com/, 响应的数据均以Json的数据格式返回。
-
版本
网站的版本均为v1 , 建议在http协议的请求报文中指定 Accept-Version 属性:
Accept-Version: v1
-
HTTP 请求动作
- GET 获取资源
- POST 创建资源
- PUT 更新资源
- DELETE 删除资源
-
错误信息
如果发生错误,服务器和客户端都会收到错误信息,错误信息以 errors 数组 组成。例如
404 未找到网页
{ "errors": ["Username is missing", "Password cannot be blank"] }
-
认证
//TODO
-
分页
返回多页的数据的时候,默认使用 page 表示页数,使用 per_page 表示每页返回的数据 默认每页数据返回10条,每页最多可返回30条数据。
如果不支持分页,默认返回第一页数据。
-
请求限制
当 程序处于开发者模式,UnSplash的API 请求次数限定为每小时 50次,当程序通过审核 请求的次数可以提高到每小时500次,每一次请求后,在相应头里面都会返回当前的剩余的请求次数
X-Ratelimit-Limit: 1000 X-Ratelimit-Remaining: 999
目前只有Json的请求数据会被计算其中(eg , api.unsplash.com),图片文件请求(images.unsplash.com)不会被计算到请求限制中。如果需要更高的请求 请联系我们。
-
用户
//TODO
-
照片
- 获取 一页照片
请求方式
GET /photos
参数:
参数 描述 page 请求的页数(默认 1) per_page 每页返回的数据个数(默认 10) order_by 可选项 数据如果排序(有效值 :latest ,oldest,popular) 响应格式:
200 OK Link: <https://api.unsplash.com/photos?page=1>; rel="first", <https://api.unsplash.com/photos?page=1>; rel="prev", <https://api.unsplash.com/photos?page=346>; rel="last", <https://api.unsplash.com/photos?page=3>; rel="next" X-Ratelimit-Limit: 1000 X-Ratelimit-Remaining: 999
[ { "id": "LBI7cgq3pbM", "created_at": "2016-05-03T11:00:28-04:00", "width": 5245, "height": 3497, "color": "#60544D", "likes": 12, "liked_by_user": false, "user": { "id": "pXhwzz1JtQU", "username": "poorkane", "name": "Gilbert Kane", "portfolio_url": "https://theylooklikeeggsorsomething.com/", "bio": "XO", "location": "Way out there", "total_likes": 5, "total_photos": 74, "total_collections": 52, "profile_image": { "small": "https://images.unsplash.com/face-springmorning.jpg?q=80&fm=jpg&crop=faces&fit=crop&h=32&w=32", "medium": "https://images.unsplash.com/face-springmorning.jpg?q=80&fm=jpg&crop=faces&fit=crop&h=64&w=64", "large": "https://images.unsplash.com/face-springmorning.jpg?q=80&fm=jpg&crop=faces&fit=crop&h=128&w=128" }, "links": { "self": "https://api.unsplash.com/users/poorkane", "html": "https://unsplash.com/poorkane", "photos": "https://api.unsplash.com/users/poorkane/photos", "likes": "https://api.unsplash.com/users/poorkane/likes", "portfolio": "https://api.unsplash.com/users/poorkane/portfolio" } }, "current_user_collections": [ // The *current user's* collections that this photo belongs to. { "id": 206, "title": "Makers: Cat and Ben", "published_at": "2016-01-12T18:16:09-05:00", "curated": false, "cover_photo": { "id": "xCmvrpzctaQ", "width": 7360, "height": 4912, "color": "#040C14", "likes": 12, "liked_by_user": false, "user": { "id": "eUO1o53muso", "username": "crew", "name": "Crew", "portfolio_url": "https://crew.co/", "bio": "Work with the best designers and developers without breaking the bank. Creators of Unsplash.", "location": "Montreal", "total_likes": 0, "total_photos": 74, "total_collections": 52, "profile_image": { "small": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=32&w=32", "medium": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=64&w=64", "large": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=128&w=128" }, "links": { "self": "https://api.unsplash.com/users/crew", "html": "http://unsplash.com/crew", "photos": "https://api.unsplash.com/users/crew/photos", "likes": "https://api.unsplash.com/users/crew/likes", "portfolio": "https://api.unsplash.com/users/crew/portfolio" } }, "urls": { "raw": "https://images.unsplash.com/photo-1452457807411-4979b707c5be", "full": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy", "regular": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=1080&fit=max", "small": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=400&fit=max", "thumb": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max" }, "categories": [ { "id": 6, "title": "People", "photo_count": 9844, "links": { "self": "https://api.unsplash.com/categories/6", "photos": "https://api.unsplash.com/categories/6/photos" } } ], "links": { "self": "https://api.unsplash.com/photos/xCmvrpzctaQ", "html": "https://unsplash.com/photos/xCmvrpzctaQ", "download": "https://unsplash.com/photos/xCmvrpzctaQ/download", "download_location": "https://api.unsplash.com/photos/xCmvrpzctaQ/download" } }, "user": { "id": "eUO1o53muso", "username": "crew", "name": "Crew", "bio": "Work with the best designers and developers without breaking the bank. Creators of Unsplash.", "portfolio_url": "https://crew.co/", "bio": "Work with the best designers and developers without breaking the bank. Creators of Unsplash.", "location": "Montreal", "total_likes": 0, "total_photos": 74, "total_collections": 52, "profile_image": { "small": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=32&w=32", "medium": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=64&w=64", "large": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=128&w=128" }, "links": { "self": "https://api.unsplash.com/users/crew", "html": "https://unsplash.com/crew", "photos": "https://api.unsplash.com/users/crew/photos", "likes": "https://api.unsplash.com/users/crew/likes", "portfolio": "https://api.unsplash.com/users/crew/portfolio" } }, "links": { "self": "https://api.unsplash.com/collections/206", "html": "https://unsplash.com/collections/206", "photos": "https://api.unsplash.com/collections/206/photos" } }, // ... more collections ], "urls": { "raw": "https://images.unsplash.com/face-springmorning.jpg", "full": "https://images.unsplash.com/face-springmorning.jpg?q=75&fm=jpg", "regular": "https://images.unsplash.com/face-springmorning.jpg?q=75&fm=jpg&w=1080&fit=max", "small": "https://images.unsplash.com/face-springmorning.jpg?q=75&fm=jpg&w=400&fit=max", "thumb": "https://images.unsplash.com/face-springmorning.jpg?q=75&fm=jpg&w=200&fit=max" }, "links": { "self": "https://api.unsplash.com/photos/LBI7cgq3pbM", "html": "https://unsplash.com/photos/LBI7cgq3pbM", "download": "https://unsplash.com/photos/LBI7cgq3pbM/download", "download_location": "https://api.unsplash.com/photos/LBI7cgq3pbM/download" } }, // ... more photos ]
-
获取策划的照片
GET /photos/curated
其他格式同上。
-
获取特定Id的照片
GET /photos/:id
参数
参数 描述 id 必选项: 照片的I w 照片的宽度 单位为像素 h 照片的高度 单位为像素 rect 四个逗号分隔的整数 分别代表裁剪矩形的 x, y, width, height。 响应
200 OK X-Ratelimit-Limit: 1000 X-Ratelimit-Remaining: 999 { "id": "Dwu85P9SOIk", "created_at": "2016-05-03T11:00:28-04:00", "width": 2448, "height": 3264, "color": "#6E633A", "downloads": 1345, "likes": 24, "liked_by_user": false, "exif": { "make": "Canon", "model": "Canon EOS 40D", "exposure_time": "0.011111111111111112", "aperture": "4.970854", "focal_length": "37", "iso": 100 }, "location": { "city": "Montreal", "country": "Canada", "position": { "latitude": 45.4732984, "longitude": -73.6384879 } }, "current_user_collections": [ // The *current user's* collections that this photo belongs to. { "id": 206, "title": "Makers: Cat and Ben", "published_at": "2016-01-12T18:16:09-05:00", "curated": false, "cover_photo": { "id": "xCmvrpzctaQ", "width": 7360, "height": 4912, "color": "#040C14", "likes": 12, "liked_by_user": false, "user": { "id": "eUO1o53muso", "username": "crew", "name": "Crew", "portfolio_url": "https://crew.co/", "bio": "Work with the best designers and developers without breaking the bank.", "location": "Montreal", "total_likes": 0, "total_photos": 74, "total_collections": 52, "profile_image": { "small": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=32&w=32", "medium": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=64&w=64", "large": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=128&w=128" }, "links": { "self": "https://api.unsplash.com/users/crew", "html": "http://unsplash.com/crew", "photos": "https://api.unsplash.com/users/crew/photos", "likes": "https://api.unsplash.com/users/crew/likes", "portfolio": "https://api.unsplash.com/users/crew/portfolio" } }, "urls": { "raw": "https://images.unsplash.com/photo-1452457807411-4979b707c5be", "full": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy", "regular": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=1080&fit=max", "small": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=400&fit=max", "thumb": "https://images.unsplash.com/photo-1452457807411-4979b707c5be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max" }, "categories": [ { "id": 6, "title": "People", "photo_count": 9844, "links": { "self": "https://api.unsplash.com/categories/6", "photos": "https://api.unsplash.com/categories/6/photos" } } ], "links": { "self": "https://api.unsplash.com/photos/xCmvrpzctaQ", "html": "https://unsplash.com/photos/xCmvrpzctaQ", "download": "https://unsplash.com/photos/xCmvrpzctaQ/download", "download_location": "https://api.unsplash.com/photos/xCmvrpzctaQ/download" } }, "user": { "id": "eUO1o53muso", "username": "crew", "name": "Crew", "portfolio_url": "https://crew.co/", "bio": "Work with the best designers and developers without breaking the bank.", "location": "Montreal", "total_likes": 0, "total_photos": 74, "total_collections": 52, "profile_image": { "small": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=32&w=32", "medium": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=64&w=64", "large": "https://images.unsplash.com/profile-1441298102341-b7ba36fdc35c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&fit=crop&h=128&w=128" }, "links": { "self": "https://api.unsplash.com/users/crew", "html": "https://unsplash.com/crew", "photos": "https://api.unsplash.com/users/crew/photos", "likes": "https://api.unsplash.com/users/crew/likes", "portfolio": "https://api.unsplash.com/users/crew/portfolio" } }, "links": { "self": "https://api.unsplash.com/collections/206", "html": "https://unsplash.com/collections/206", "photos": "https://api.unsplash.com/collections/206/photos" } }, // ... more collections ], "urls": { "raw": "https://images.unsplash.com/photo-1417325384643-aac51acc9e5d", "full": "https://images.unsplash.com/photo-1417325384643-aac51acc9e5d?q=75&fm=jpg", "regular": "https://images.unsplash.com/photo-1417325384643-aac51acc9e5d?q=75&fm=jpg&w=1080&fit=max", "small": "https://images.unsplash.com/photo-1417325384643-aac51acc9e5d?q=75&fm=jpg&w=400&fit=max", "thumb": "https://images.unsplash.com/photo-1417325384643-aac51acc9e5d?q=75&fm=jpg&w=200&fit=max" }, "categories": [ { "id": 4, "title": "Nature", "photo_count": 24783, "links": { "self": "https://api.unsplash.com/categories/4", "photos": "https://api.unsplash.com/categories/4/photos" } } ], "links": { "self": "https://api.unsplash.com/photos/Dwu85P9SOIk", "html": "https://unsplash.com/photos/Dwu85P9SOIk", "download": "https://unsplash.com/photos/Dwu85P9SOIk/download" "download_location": "https://api.unsplash.com/photos/Dwu85P9SOIk/download" }, "user": { "id": "QPxL2MGqfrw", "username": "exampleuser", "name": "Joe Example", "portfolio_url": "https://example.com/", "bio": "Just an everyday Joe", "location": "Montreal", "total_likes": 5, "total_photos": 10, "total_collections": 13, "links": { "self": "https://api.unsplash.com/users/exampleuser", "html": "https://unsplash.com/exampleuser", "photos": "https://api.unsplash.com/users/exampleuser/photos", "likes": "https://api.unsplash.com/users/exampleuser/likes", "portfolio": "https://api.unsplash.com/users/exampleuser/portfolio" } } }
Note :当使用请求参数 w h 会导致裁剪的照片 返回的数据会新增urls对象:
```
{
// ...
"urls": {
"raw": "...",
"full": "...",
"regular": "...",
"small": "...",
"thumb": "...",
"custom": "https://images.unsplash.com/your-custom-image.jpg"
}
}
```
-
搜索
-
-
收藏列表
-
API状态
//TODO
网友评论