Logo Julien Janvier Inc

API Booster

Version: 1.0.1
API Booster is a simple, fast and versatile way to start using Akeneo PIM API.

Seamlessly use the API

The Akeneo PIM web API is well documented, robust and more importantly stable which makes it a great way to connect your PIM. It has one drawback nonetheless : importing products requires the same complex and costly boilerplate code on every project as the API is very strict. API booster fixes this problem.

Imagine you want to import a product via the API. It has two attributes : a_boolean and a_date. Your input data is probably heterogeneous as it comes from various sources. As the Akeneo API is really strict, you need to format that data correctly. You need to know the attribute a_boolean is a boolean, so you call the GET AN ATTRIBUTE endpoint. Same for the a_date attributes. If you have a lot of attributes data per product to handle, you can’t afford an API call for each attribute. You’re smart and use the GET LIST OF ATTRIBUTES endpoint instead. Great! But now you need a lot more API calls to know if the foo attribute option really exists, if this bar reference entity record is valid or if the baz asset is still present. You must perform those API calls and many others, otherwise your whole product wouldn’t be updated if only one of these elements was invalid. The bad thing is you have (hundreds of) thousands of products data to import. Calling constantly back and forth the Akeneo API will be incredibly slow. You’re smart and you understand you’ll need a caching system. Good news, API booster is here for you!

API Booster is a PHP caching library dedicated to handle Akeneo PIM API calls. It’s compatible with every cache provider you can think about and super simple to use. For instance, $attribute = $apiBooster->getAttribute(‘a_boolean’); will return the a_boolean attribute from the cache or call the API and store it in the cache before returning it. It goes the same for every catalog structure resource. API Booster also provides a convenient method to format input data via $apiBooster->formatProduct($data) ($apiBooster->formatProductModel($data)). You can learn more about it in the Documentation.

API Booster ships with several demos :

  • one to show how API Booster can be integrated inside a Symfony project
  • one to show how API Booster can be integrated inside a non Symfony project or inside a PHP project that does not use any framework
  • one to show how using API Booster can drastically improve performances. On this very simple example, performances are improved by ~9. Of course, the bigger the catalog and/or the products (or product models) are, the bigger this ratio would be.

Features

  • A simple, powerful and versatile cache solution for all resources of the catalog structure that need to be defined when creating or updating a product or a product model. That includes categories, attributes, attribute options, attribute groups, association types, locales, channels, currencies, measure families, measurement families, reference entity records and assets.
  • Drastically improve performances compared to naive API calls.
  • An opinionated way to format input data into API format.
  • 100% Akeneo API compatible. It relies on the official Akeneo API client. No change is made to API responses and errors.
  • A convenient way to debug and log when you call the API or when you directly use the cache.
  • Examples about how to use the library

FAQ

Which kind of caches are supported?

Every caching library that supports PSR6 or Symfony’s cache contracts. That means you can use memcached, Redis, APCu, Couchbase, Doctrine, the memory, the filesystem and many others caching solutions. You can also combine several caching systems to create a cache chain if you need to.

If your project is Symfony based, you just have to configure your caches in your configuration file. All those caches will work out of the box. If you don’t have a Symfony project, no worries, API booster is simple and straightforward to configure.

Which API resources are supported?

All resources of the catalog structure that need to be defined when creating or updating a product or a product model :

Depending on the version of Akeneo you use, some endpoints may be unavailable.

Which Akeneo editions are supported?

All editions. Community, Enterprise, Flexibility and Serenity.

Which Akeneo versions are supported?

All versions ⩾ Akeneo PIM 3.0. That includes v3.0, v3.1, v3.2, v4.0 and SaaS Serenity.

Is there a cache for products and product models?

No. Since in most cases products and product models data need to be fresh. Contact me in case of need.

Is it compatible with every PHP application?

Yes. This extension is standard PHP code that can be integrated in every existing application. As it relies on the official Akeneo API client, it requires PHP ⩾ 7.1.

Is it compatible with every PHP framework?

Yes. Even if at the moment, only Symfony is plug and play. Contact me in case of need.

What if I don’t use PHP on my project? What about an HTTP cache?

It’s easy to build an HTTP cache middleware on top of this extension. Contact me in case of need.

Which cache solution to use?

It's up to you! The two most known cache solutions are probably memcached and Redis. They both work well for our use case and both have their pros and cons. If you want to know more about different cache solutions, you can take a look to this article.

What about memory consumption?

Depending on the size of your catalog, the memory footprint of your cache can grow. To know about your needs and what could happen in production, the best is probably to try beforehand to cache everything you'll need on a staging environment.

What if I have very special needs for my very special project?

You can contact me :)

Whose is behind API booster?

Julien Janvier is an Akeneo expert freelancer who can intervene on any type of project, whether it is custom developments, connector integrations (by files or API), installations or migrations. He has recently retired from Akeneo where he worked for 6 years as a developer, lead developer and architect. He also holds Akeneo's technical and functional certifications.

Contact

You can drop me an email at “j dot janvier at gmail dot com” or send me a message on Linkedin.

Documentation
Release notes