Madværkstedet

Automating data with JSON

Introduction

Madværkstedet allows suppliers to make a automated process of publishing data into the platform by using a cronjob. The cronjob allows the supplier to create and update data.

The following section describes what data is currently supported through the cronjob.

The following data is not supported yet.

Our systems runs a cronjob which requests JSON documents from your service on a URL passed into your supplier profile. We will append a timestamp (Unix time) to the URL, which is the timestamp of the last cronjob. This parameter can be used to make sure only new/updated data is returned to our request.

The appended parameter is called since and could look like this since=1546340400.

The cronjob is a automated process and is scheduled to run at 01:00 every night. It is however possible to run a manually cronjob through your supplier profile.

Please use the manually cronjob functionality with care and only in emergency situations, such as corrupt or incorrect data.

Getting started

To get started with using the cronjob, we recommend reading the document and the dataset schemas.

Schemas

The schemas describe how you should structure your JSON document, along with data types, examples, and limitations. The schemas can be found in the left section of this page.

Backend

Under your supplier profile, there are a few settings fields which allows you to make use of the automated process. Each data sections has a URL field. This URL is the one, our service requests for a JSON document to process.

The settings also gives the possibility to enable/disable the cronjob, along with some authentication methods. You will also find the button to create a manually cronjob on the settings page.

Implementing

Since our cronjob is a pull-based service, it requires you to host a endpoint/URL that we can request and fetch the relevant JSON document.

Your endpoint/URL has to be passed into your supplier profile settings.

Example of a recipe URL

https://www.example.com/api/v1/recipes

Our service appends the datetime parameter since to the URL, for when the last cronjob was executed. The full URL would look like this:

https://www.example.com/api/v1/recipes?since=1546340400

Our service supports the following authentication methods for requesting your URL.

Authentication methods not yet implemented

Examples of JSONdocuments

In order for us to process your data, it is important that your JSON document implements our JSON schemas. It is important the JSON always is returned as a array, even if just a single entity is returned.

[
    {
        "identifier":1230932,
        "short_name":"Orange-passion fruit syrup with pineapple",
        ...
    },
    {
        "identifier":2931865,
        "short_name":"Shrimps with chili and garlic",
        ...
    }
]

Questions?

Feel free to contact dev@digitalpartners.dk with any questions.

Happy coding!