How do I import Pexels API library in Processing?

Hello, I am attempting to use an API for the first time but am having some trouble. Here is the API that I have chosen: Pexels API Documentation.

I have already received an API key and tried to adapt the following JavaScript code from the documentation to search for images:

import { createClient } from 'pexels';
const client = createClient('myAPIKeyHere');
const query = 'Nature';
client.photos.search({ query, per_page: 1 }).then(photos => {...});'

I think the first issue I am having is that I am not able to import the pexels library? Can anyone help me figure out how to rewrite the first line of code in Processing?

Welcome to the forum.

I would guess that ‘pexels’ library (a file) is not in the same folder as your javascript file is. Import statement as is requires it. import - JavaScript | MDN for example tells you a bit more about imports and has some examples too.