Medipim FR - API V4

Developer documentation

Frequently asked questions

(Last updated: 21/10/2024)

How to handle API requests of 100/min?

if you expect to do more calls per minute, these are the ways of handling that:

  • Use Medipim as CDN, which means you refer to our url and have no limitations.
    Disadvantage: when Medipim is in maintenance, you will have no data
  • Store the data locally and synchronize regularly. You can avoid the request limit by
    • spacing you requests in time (one of our POS customers has hundreds of end clients and uses this technique)
    • using serveral API keys so you can switch to a different key when the limit has been reached

For your first import of product data there are 2 endpoints available:

  • the amount of products you expect to get will be less then 10000 products -> choose 'query'
  • the amount or products you expect is more then 10000 products (or unknown) -> choose 'streaming'
    • Each line in the response is a json and contains information for 1 product
    • You can start processing the data immediately
    • Tip: you need to log which products have been processed, so you don't need to start all over when the connection is lost

How to deal with product status

You can use a filter in the body of the API request to select only the active products, for example. Inactive can be used to phase out products in your online application. Because when a product is inactive in Medipim it won’t be sold any more and there most likely won’t be any stock for that product anymore.

{
"status": "active"
}

In what format are prices returned through the API?

We always return prices in the basedenomation (= lowest amount of the currency) to make sure there are no rounding errors. You can get the correct format by dividing the given number by 100.

ex. API response is returning "820" for a price field; This means that the price is €8.20.

How to request a large set of data?

You will have to decide in what way you are going to import data.

The products are presented through a newline in the response stream, appearing line by line. This allows for immediate data processing instead of waiting for the entire stream to receive and process a complete data block. If you're conducting tests, it's advisable to utilize the query endpoint, specifying pagination for optimal results.

Acquiring all information through a single API call is feasible, but it's crucial to note that the resulting response will be substantial. We strongly advise promptly handling the data to avoid buffering delays and initiate processing immediately. Neglecting this step may introduce risks and lead to failures. This precaution ensures the seamless operation of your system, allowing you to import data worry-free and maintain smooth functionality.

How to know which fields are available?

We have an endpoint that can be called to request all the fields available get-fields. Those can be used to filter on using the hasContent filter in the body.

Product Identifiers

Not all products have a product identifier code.
If you need to have a unique code for a product, you should use the Medipim product ID.

Products can have multiple EAN codes; Europe also intended to use this as a cross country unique product code. In reality this code has duplicates...

Setting Up Media Integration

Initial Sync

To start syncing your products or media:

Starting with Products:

Use the product query or stream function to start. Remember to save the date when you last synced (we’ll call this lastSyncedOn).

Starting with Media:

Similarly, use the media query or stream function and save the sync date as lastSyncedOn.

Daily Sync

For daily updates:

  • Use the updatedSince filter to make sure you only get new or updated products or media.
  • After each sync, update the lastSyncedOn date to ensure you're only syncing what's new.

Syncing Media Items

  • Store the IDs and URLs of your media files locally (on your system).
  • When syncing, check if each media file has been synced before:
    • If yes, compare the new URL with the one stored. Update it if needed.
    • If a media file is missing, remove its ID from your local records.

This method keeps your files up-to-date and clears out any that are no longer available.