Unsplash 提供的開發(fā)文檔

APP定位

? 圖片壁紙 采用Splash網(wǎng)站,提供的后臺(tái)支持墨状,開發(fā)的第三方圖片壁紙客戶端杯瞻。

API 說(shuō)明

  1. 地址

    網(wǎng)站的baseUrl: https://api.unsplash.com/, 響應(yīng)的數(shù)據(jù)均以Json的數(shù)據(jù)格式返回扭吁。

  2. 版本

    網(wǎng)站的版本均為v1 , 建議在http協(xié)議的請(qǐng)求報(bào)文中指定 Accept-Version 屬性:

    Accept-Version: v1

  3. HTTP 請(qǐng)求動(dòng)作

    • GET 獲取資源
    • POST 創(chuàng)建資源
    • PUT 更新資源
    • DELETE 刪除資源
  4. 錯(cuò)誤信息

    如果發(fā)生錯(cuò)誤球碉,服務(wù)器和客戶端都會(huì)收到錯(cuò)誤信息蜓斧,錯(cuò)誤信息以 errors 數(shù)組 組成。例如

    404 未找到網(wǎng)頁(yè)

    {
      "errors": ["Username is missing", "Password cannot be blank"]
    }
    
  5. 認(rèn)證

    //TODO

  6. 分頁(yè)

    返回多頁(yè)的數(shù)據(jù)的時(shí)候汁尺,默認(rèn)使用 page 表示頁(yè)數(shù)法精,使用 per_page 表示每頁(yè)返回的數(shù)據(jù) 默認(rèn)每頁(yè)數(shù)據(jù)返回10條,每頁(yè)最多可返回30條數(shù)據(jù)痴突。

    如果不支持分頁(yè)搂蜓,默認(rèn)返回第一頁(yè)數(shù)據(jù)。

  7. 請(qǐng)求限制

    當(dāng) 程序處于開發(fā)者模式辽装,UnSplash的API 請(qǐng)求次數(shù)限定為每小時(shí) 50次帮碰,當(dāng)程序通過(guò)審核 請(qǐng)求的次數(shù)可以提高到每小時(shí)500次,每一次請(qǐng)求后拾积,在相應(yīng)頭里面都會(huì)返回當(dāng)前的剩余的請(qǐng)求次數(shù)

    X-Ratelimit-Limit: 1000
    X-Ratelimit-Remaining: 999
    

    目前只有Json的請(qǐng)求數(shù)據(jù)會(huì)被計(jì)算其中(eg , api.unsplash.com)殉挽,圖片文件請(qǐng)求(images.unsplash.com)不會(huì)被計(jì)算到請(qǐng)求限制中。如果需要更高的請(qǐng)求 請(qǐng)聯(lián)系我們拓巧。

  8. 用戶

    //TODO

  9. 照片

    • 獲取 一頁(yè)照片

    請(qǐng)求方式

    GET /photos

    參數(shù):

    參數(shù) 描述
    page 請(qǐng)求的頁(yè)數(shù)(默認(rèn) 1)
    per_page 每頁(yè)返回的數(shù)據(jù)個(gè)數(shù)(默認(rèn) 10)
    order_by 可選項(xiàng) 數(shù)據(jù)如果排序(有效值 :latest ,oldest,popular

    響應(yīng)格式:

    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

    參數(shù)

    參數(shù) 描述
    id 必選項(xiàng): 照片的I
    w 照片的寬度 單位為像素
    h 照片的高度 單位為像素
    rect 四個(gè)逗號(hào)分隔的整數(shù) 分別代表裁剪矩形的 x, y, width, height。

    響應(yīng)

    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 :當(dāng)使用請(qǐng)求參數(shù) w h 會(huì)導(dǎo)致裁剪的照片 返回的數(shù)據(jù)會(huì)新增urls對(duì)象:

 ```
 {
   // ... 
   "urls": {
     "raw":     "...",
     "full":    "...",
     "regular": "...", 
     "small":   "...",
     "thumb":   "...",
     "custom":  "https://images.unsplash.com/your-custom-image.jpg"
  }
 }
 ```
  1. 搜索

  2. ?

  3. 收藏列表

  4. API狀態(tài)
    //TODO

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末肛度,一起剝皮案震驚了整個(gè)濱河市傻唾,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌承耿,老刑警劉巖冠骄,帶你破解...
    沈念sama閱讀 211,817評(píng)論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異加袋,居然都是意外死亡凛辣,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,329評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門职烧,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)扁誓,“玉大人,你說(shuō)我怎么就攤上這事蚀之“侠恚” “怎么了?”我有些...
    開封第一講書人閱讀 157,354評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵恬总,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我肚邢,道長(zhǎng)壹堰,這世上最難降的妖魔是什么拭卿? 我笑而不...
    開封第一講書人閱讀 56,498評(píng)論 1 284
  • 正文 為了忘掉前任,我火速辦了婚禮贱纠,結(jié)果婚禮上峻厚,老公的妹妹穿的比我還像新娘。我一直安慰自己谆焊,他們只是感情好惠桃,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,600評(píng)論 6 386
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著辖试,像睡著了一般辜王。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上罐孝,一...
    開封第一講書人閱讀 49,829評(píng)論 1 290
  • 那天呐馆,我揣著相機(jī)與錄音,去河邊找鬼莲兢。 笑死汹来,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的改艇。 我是一名探鬼主播收班,決...
    沈念sama閱讀 38,979評(píng)論 3 408
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼谒兄!你這毒婦竟也來(lái)了摔桦?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,722評(píng)論 0 266
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤舵变,失蹤者是張志新(化名)和其女友劉穎酣溃,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體纪隙,經(jīng)...
    沈念sama閱讀 44,189評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡赊豌,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,519評(píng)論 2 327
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了绵咱。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片碘饼。...
    茶點(diǎn)故事閱讀 38,654評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖悲伶,靈堂內(nèi)的尸體忽然破棺而出艾恼,到底是詐尸還是另有隱情,我是刑警寧澤麸锉,帶...
    沈念sama閱讀 34,329評(píng)論 4 330
  • 正文 年R本政府宣布钠绍,位于F島的核電站,受9級(jí)特大地震影響花沉,放射性物質(zhì)發(fā)生泄漏柳爽。R本人自食惡果不足惜媳握,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,940評(píng)論 3 313
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望磷脯。 院中可真熱鬧蛾找,春花似錦、人聲如沸赵誓。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,762評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)俩功。三九已至幻枉,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間绑雄,已是汗流浹背展辞。 一陣腳步聲響...
    開封第一講書人閱讀 31,993評(píng)論 1 266
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留万牺,地道東北人罗珍。 一個(gè)月前我還...
    沈念sama閱讀 46,382評(píng)論 2 360
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像脚粟,于是被迫代替她去往敵國(guó)和親覆旱。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,543評(píng)論 2 349

推薦閱讀更多精彩內(nèi)容