unsplash v1.0.0 Unsplash.Photos View Source

Link to this section Summary

Functions

GET /photos

GET /photos/curated Note: See the note on hotlinking

GET /photos/:id/download

GET /photos/:id

POST /photos/:id/like

GET /photos/random

POST /photos/:id/statistics

DELETE /photos/:id/like

PUT /photos/:id

Link to this section Functions

GET /photos

Args:

  • order_by - How to sort the photos. Optional. (Valid values: latest, oldest, popular; default: latest)

GET /photos/curated Note: See the note on hotlinking.

Args:

'page' - Page number to retrieve. (Optional; default: 1)
'per_page' - Number of items per page. (Optional; default: 10)
'order_by' -  How to sort the photos. Optional. (Valid values: latest, oldest, popular; default: latest)

GET /photos/:id/download

Args:

  • id - the photo id

GET /photos/:id

Args:

  • id - the photo id

Options:

  • w - Image width in pixels.
  • h - Image height in pixels.
  • rect - 4 comma-separated integers representing x, y, width, height of the cropped rectangle.

POST /photos/:id/like

Args:

  • id - the photo id

Requires the write_likes scope

GET /photos/random

Args:

  • opts - Keyword list of options

Options:

  • collections - Public collection ID(‘s) to filter selection. If multiple, comma-separated
  • featured - Limit selection to featured photos.
  • username - Limit selection to a single user.
  • query -Limit selection to photos matching a search term.
  • w -Image width in pixels.
  • h -Image height in pixels.
  • orientation -Filter search results by photo orientation. Valid values are landscape, portrait, and squarish.
  • count -The number of photos to return. (Default: 1; max: 30)
Link to this function statistics(id, opts \\ []) View Source

POST /photos/:id/statistics

Args

  • id - The public id of the photo. Required.

Options:

  • resolution - The frequency of the stats. (Optional; default: “days”)
  • quantity - The amount of for each stat. (Optional; default: 30)

DELETE /photos/:id/like

Args:

  • id - the photo id

PUT /photos/:id

Args:

  • id - The photo’s ID. Required.

Options:

  • location[latitude] The photo location’s latitude (Optional)
  • location[longitude] The photo location’s longitude (Optional)
  • location[name] The photo location’s name (Optional)
  • location[city] The photo location’s city (Optional)
  • location[country] The photo location’s country (Optional)
  • location[confidential] The photo location’s confidentiality (Optional)
  • exif[make] Camera’s brand (Optional)
  • exif[model] Camera’s model (Optional)
  • exif[exposure_time] Camera’s exposure time (Optional)
  • exif[aperture_value] Camera’s aperture value (Optional)
  • exif[focal_length] Camera’s focal length (Optional)
  • exif[iso_speed_ratings] Camera’s iso (Optional)

Requires the write_photos scope