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.
- Base URL: `https://api.openpim.io/v1`
- Swagger Documentation: Explore the list of REST endpoints, their parameters, and example requests and responses in our Swagger documentation.
Example REST Endpoint:
GET https://api.openpim.io/v1/image/{image_id}?resolution=medres&ratio=sq- Description: Retrieve an image file of a medium resolution and a square 1:1 ratio.
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.
- Base URL: `https://api.openpim.io/v1/graphql`
- GraphiQL Playground: Explore the GraphQL schema, write queries, and test them interactively in our GraphiQL playground. If you want to find out how to use the GraphiQL playground here is a useful article.
Example GraphQL Query:
query {
getProducts(GetProductsInput: {
product_ids: ["6647c18f1294fb312eb1cf97"]
}) {
name_universal
title {
short
}
primary_media {
image {
image_id
alt_text
}
}
}
}- Description: Retrieve information about a specific product.
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"