Unveiling our DFC API and current developments

Topics covered here

  • Current state of OFN APIs
  • Copying product catalogs across platforms.
  • Placing orders across platforms.

Which APIs do we have?

The Open Food Network app inherited an API from Spree which we now call APIv0. It works internally, some people build integrations with it but it’s not documented and we officially don’t support it. We may change it at any time.

So we came up with APIv1 which was supposed to be a fresh start for integrations with a stable interface. But past the first endpoint (customers) there was no more momentum for further implementations.

By the time we wanted to improve discovery of OFN data with integrations, the Data Food Consortium (DFC) standard was finally mature enough to support this.

What is the DFC standard

Around ten years ago, the DFC was built to enable interoperability between platforms like the Open Food Network. It is a data model for products, catalogs, offers, transformations of products and more. Some ideas we had within OFN a decade ago but were not able to implement got at least defined on paper within the DFC standard.

The standard is built on the Semantic Web which is a set of official W3C standards to make the web more machine readable. This enables us to not just create our own API but also integrate it with other standards. Open and collaborative.

The standard is still under active development and open to contributors. When we have a need for a new data structure within the standard then there’s a good chance that it will be accommodated.

Open Food Network’s DFC API

The current documentation of the API can be seen on each instance, like this one:

Product catalog

Through the API you can read your product catalog including stock levels and prices in a standardised format. That means that other platforms support the DFC can read your products (with your permission) and you can sync your products across platforms.

One production use of the catalog are the platforms Discover Regenerative and Waterloo Region Food Directory. They use the DFC API to pull enterprise and product data, enrich it with certifications and present it in a beautiful way for discovery.

Product import

The OFN product import also supports reading from the DFC API. So you can copy catalogs from other OFN instances and possibly other platforms. There’s a DFC integration for Shopify through which you can import your catalog.

@RaggedStaff, can you tell us more how people can get access to that integration if they have a Shopify shop already?

@Rachel, do you know about other platforms we could import from?

Backorders

Once you imported products from another catalog, OFN can place backorders with the supplier shop. In our current pilots, we have a Shopify shop as wholesaler and an OFN shop as retailer. Customers place orders on OFN and OFN places backorders on Shopify depending on stock levels. This also includes the transformation from retail products to wholesale products. For example customers order individual cans of beans and the backorder is placed for slabs of 12 cans of beans.

The implementation is still rough around the edges and in active development but the basic functionality works. We have a quite narrow set of supported use cases based on the needs of the participating enterprises. If you want to use this, you may want to check with me or @RaggedStaff if your use case is supported already.

Future developments

It looks like the DFC API will be the main API for our integrations in the future. There’s no plan to extend the other two APIs.

There are plans to support placing orders on OFN via the API. Then the current backordering logic could not just go from OFN to Shopify but also the other way round for from OFN to OFN. This may replace some of our current network features of connecting suppliers and distributors in order cycles. It would enable us to have suppliers on different platforms or to sell to distributors on other platforms.

A common topic in the GOAT community in the US was procurement. The DFC standard could fit into that work as well but the direction is unclear to me at the moment.

One potential development could be the integration with farm management software like LiteFarm. This could help farmers to provide their harvest data as product catalog to buyers via the DFC standard. This needs funding though.

Do you see other useful integrations that may fit into the DFC standard?