API Endpoints

The openPIM API provides both REST and GraphQL endpoints. This section provides an overview of the available endpoints and how to use them.


REST Endpoints

Our REST endpoints are designed for handling media queries and are documented using Swagger. The REST API follows standard REST principles, making it easy to integrate with existing systems.

Example REST Endpoint:

GET https://api.openpim.io/v1/image/{image_id}?resolution=medres&ratio=sq

GraphQL Endpoint

Our GraphQL API is the primary interface for accessing and updating product data. GraphQL provides a flexible and intuitive way to query and mutate data, allowing you to specify exactly what you need.

Example GraphQL Query:

query {
    getProducts(GetProductsInput: {
        product_ids: ["6647c18f1294fb312eb1cf97"]
    }) {
        name_universal
        title {
            short
        }
        primary_media {
            image {
                image_id
                alt_text
            }
        }
    }
}

Authentication

Both the REST and GraphQL endpoints require authentication via an API token. Include your API token in the request headers as follows:

Authorization: "YOUR_API_TOKEN"

Next we will cover: