Temadagar.se API v0.1

General information

This API is used to access data from the website temadagar.se.
The API is created to help other to build services based on our data.

You can get the following data:
All days from one year
Day based on ID
All days during one date

Access to the API

To gain access to the API you need to be a member of Temadagar.se's vänner and pay a minimum of 50 SEK/month.
As long as you are a member you will get a unique ID (uid) that you are using together with your request, when cancelling your subscription you will no longer have access to the API.
To become a member of Temadagar.se's vänner, read more here.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without correct uid will also fail.

Get all days from one year

This function is used to get all days that are celebrated one specific year.
You are able to receive all dates during current year +/- 2 years. So during 2021 you can get data for the years 2019-2023.
To get the data you need to send the parameter year as a query string.
If there is no value in the link field it will return null.

Example:

https://temadagar.se/api/v1/days/read.php?uid={uid}&year={year}
https://temadagar.se/api/v1/days/read.php?uid=sub_Un1qUe3ld&year=2021

Returned data
{
    "response": [
        {
            "id": "213",
            "name": "Internationella pizzadagen",
            "link": "https://temadagar.se/internationella-pizzadagen/",
            "date": "2021-01-01"
        },
        {
            "id": "313",
            "name": "Nyårsdagen",
            "link": null,
            "date": "2021-01-01"
        }
	...
	]
}

Get one day based on id

This will probably be the least used endpoint right now. If there is no value in the link field it will return null.

Example:

https://temadagar.se/api/v1/days/read_one.php?uid={uid}&year={year}&id={id}
https://temadagar.se/api/v1/days/read_one.php?uid=sub_Un1qUe3ld&year=2021&id=313

Returned data
{
    "response": {
        "id": "313",
        "name": "Nyårsdagen",
        "link": "https://temadagar.se/nyarsdagen/",
        "date": "2021-01-01"
    }
}

Get all days from one date

You should use the following date format Year-Month-Day with in
We have also added the input today which fetch all days of today. If there is no value in the link field it will return null.

Example:

https://temadagar.se/api/v1/days/read_date.php?uid={uid}&date={date}
https://temadagar.se/api/v1/days/read_date.php?uid=sub_Un1qUe3ld&date=2021-01-01
https://temadagar.se/api/v1/days/read_date.php?uid=sub_Un1qUe3ld&date=today

Returned data
{
    "response": [
        {
            "id": "313",
            "name": "Nyårsdagen",
            "link": null,
            "date": "2020-01-01"
        },
        {
            "id": "213",
            "name": "Internationella pizzadagen",
            "link": "https://temadagar.se/internationella-pizzadagen/",
            "date": "2020-01-01"
        }
    ]
}

Errors

We are using conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.).

Here are some examples of error codes and responses that can be sent.
400
You are not using HTTPS protocol.
Your request is missing parameters.
At least one of your parameters is having incorrect format.
402
The year you are trying to fetch is out of bounds.
403
You don't have access to this feed.
404
No day found.