DEV Community

Virginie
Virginie

Posted on

API Pexels (API keys + color search)

We are 3 learners in dev school, for a data visualization project, realized in JavaScript. We used the Pexels API, but we encountered problems when we followed its documentation.
This one is rather light and did not work for us.
Here's how we solved our hang-ups:

  • Authorization to insert the API key Pexels documentation:
import { createClient } from 'pexels';
const client = createClient('YOUR_API_KEY');
Enter fullscreen mode Exit fullscreen mode

Our solution:

headers: { 
Authorization: "YOUR_API_KEY",
}
Enter fullscreen mode Exit fullscreen mode
  • Search for a photo by color: remove the # in front of the hexadecimal code (in lower case).

Marine, Audrey & Virginie

Top comments (0)