Pexels

This is not a Low Code extension, but a library.

About

Pexels is a third-party service that provides stock image and video assets. This extension is available in the form of a Javascript client.

To use the Pexels client in production, you will need a production-ready Pexels account.

Configuration

To use the Pexels extension:
  1. Obtain the PexelsAPI production apiKey.

  2. Place the extensions in a directory where it can be imported into an automation script.

  3. Initialize the Pexels client.

Usage

// To use the Pexels client, first import the client into the desired automation script
import PexelsClient from 'pexels/lib/'

// Next step is to initialize the Pexels client with the `apiKey`
const pexelsClient = new PexelsClient(apiKey)

// The client is now ready to accept querries, for example
const images = await pexelsClient.searchPhotos({ query: 'Example', perPage: 10, page: 1 })

Available queries

searchPhotos(query: '', perPage: 10, page: 1)

Fetches images that match the query base on the provided pagination data.

getPhotoByID(photoID: '')

Fetches the image under the provided Pexels photoID.

searchVideos(query: '', perPage: 10, page: 1)

Fetches images that match the query base on the provided pagination data.

Example response for images

{
  // Pexels image ID
  id,
  preview: {
    // URL to original image,
    original,
    // URL to regular sized image,
    regular,
    // URL to large size image
    large,
    // URL to the thumbnail size image
    thumbnail,
  },
  author: {
    // Image author name
    name,
    // URL to the Pexels author profile
    url,
  },
  // Origin of the image
  origin: 'Pexels',
}

Example response for videos

{
  id,
  // Pexels video ID
  preview: {
    // URL to the video thumbnail size image
    thumbnail,
  },
  // Actual video URL on Pexels
  video,
  author: {
    // Image author name
    name,
    // URL to the Pexels author profile
    url,
  },
  // Origin of the video
  origin: 'Pexels',
}