I want to access a specific photo via the Unsplash API and a given photo ID. Unfortunately my approaches didn't succeed and it seems that no other person on google tried it yet.
As stated here:
Endpoint: https://api.unsplash.com/
GET /photos/:id
Provide as a parameter the photo's id as well as your access key:
nDV6ahWLvEg
client_id
, e.g. 123123123123
https://api.unsplash.com/photos/:id?id=nDV6ahWLvEg&client_id=123123123123
I always get an 404 - Couldn't find photo
. Authorization works, tried this with other unsplash endpoints. Tried to access it via python ´request` package and Insomnia (REST Client), both the same error. Tried also the "collections endpoint" who also needs an id (collection id) - error 404.
I assume that I do something wrong with the :id ? id = ...
Has anybody an idea?
RESTful API can make use of different types of parameters, e.g.
The Unsplash API makes use of both types of parameters. client_id
is a query parameter while id
is a path parameter. You can recognize this by the colon (:) used in the documentation (/photos/:id
).
Thus you must replace :id
with the actual photo id. You request looks then like:
https://api.unsplash.com/photos/nDV6ahWLvEg?client_id=YOUR_ACCESS_KEY