index

REST API version 1 Frister

Version: 1.0

The Frister REST API lets a Danish Authority interact with all calendar entries that the Authority has created.

Introduction

The Frister REST API lets a Danish Authority deliver events from the authority to the companies calendar at Mit Virk.dk, and to read, update and cancel Events. Only Authorities can access Events and only Events owned by the authority can be manipulated.

This page describes detailed information about the Frist API. For general information about Virk.dk REST API - security, status codes etc - refer to Virk.dk REST API Introduction

URL

The general url for manipulating Frist is:

   https://api.virk.dk/calendar/1/events

The relative path prefix '/1/' indicates that this is version 1 of the API.

Methods

Method Url Description
POST https://api.virk.dk/calendar/1/frister Create a Frist to be shown in one or more company calendar
GET https://api.virk.dk/calendar/1/frister Get all Frister ordered by first date of delivery
GET https://api.virk.dk/calendar/1/frister/{id} Get the Frist with the specified id
PUT https://api.virk.dk/calendar/1/frister/{id} Update a Frist
DELETE https://api.virk.dk/calendar/1/frister/{id} Delete the Frist with the specified id

POST: Create an Frist

URL

https://api.virk.dk/calendar/1/frister

Description

Create a new Frist. The id is autogenerated and returned with the object

Post document - JSON fields

Field Description Required Constraints Type
overskrift The title of the event true Max: 255 chars String
beskrivelse The description of the event true Max: 10.000 chars String
fristDato A date in the future when the event starts true Format: "dd-MM-yyyy" String
modtagere A comma-separated string of CVR-numbers true Valid CVR-numbers or "" for all String

Example request

$ curl -X POST -H "Accept: application/json" -H "Content-Type: application/json"
  -d '{"beskrivelse":"<p>Min beskrivelse opdateret<\/p>\n", "overskrift":"Min Titel", "link":"https://google.dk", "modtagere":"10150817", "fristDato":"09-04-2019", "afsenderCvr": "10150817"}'
  https://api.virk.dk/calendar/1/frister

Example JSON response if a new event was created

{ "fristId": 10, "afsenderCvr": "10150817", "afsenderNavn": "Erhvervsstyrelsen", "fristDato": "09-04-2019", "overskrift": "Min Titel", "beskrivelse": "<p>Min beskrivelse opdateret</p>\n", "antalModtagere": 1 }


GET: List all events

URL

https://api.virk.dk/calendar/1/frister

Description

Get a complete list of all Calendar frister created by the Authority.

Example request

$ curl -X GET https://api.virk.dk/calendar/1/frister

Example JSON response if any Frister was found

[
{
    "fristId": 1,
    "afsenderCvr": "10150817",
    "afsenderNavn": "Erhvervsstyrelsen",
    "fristDato": "05-04-2019",
    "overskrift": "tester",
    "beskrivelse": "<p>tester</p>\n",
    "link": "https://google.dk",
},
{
    "fristId": 2,
    "afsenderCvr": "10150817",
    "afsenderNavn": "Erhvervsstyrelsen",
    "fristDato": "06-04-2019",
    "overskrift": "rrrr",
    "beskrivelse": "<p>rrrrr</p>\n",
    "link": "https://google.dk",
},
   ...
]

GET: Get a Frist

URL

https://api.virk.dk/calendar/1/frister/{id}

Description

Get a Frist by its 'id'

Example request

$ curl -X GET https://api.virk.dk/calendar/1/frister/10

Example JSON response when an Event was found

{
    "fristId": 10,
    "afsenderCvr": "10150817",
    "afsenderNavn": "Erhvervsstyrelsen",
    "fristDato": "09-04-2019",
    "overskrift": "Min Titel",
    "modtagere": "",
    "beskrivelse": "<p>Min beskrivelse opdateret</p>\n",
    "link": "https://google.dk"
}

PUT: Update a Frist

URL

https://api.virk.dk/calendar/1/frister/{id}

PUT document - JSON fields

This table is an extension of the Post document - JSON fields, please consult that table for the other fields required.

Field Description Required Constraints Type
overskrift The title of the event true Max: 255 chars String
beskrivelse The description of the event true Max: 10.000 chars String
fristDato A date in the future when the event starts true Format: "dd-MM-yyyy" String
modtagere A comma-separated string of CVR-numbers true Valid CVR-numbers String

Example request

$ curl -X PUT -H "Accept: application/json" -H "Content-Type: application/json"
  -d '{"beskrivelse":"<p>Min beskrivelse opdateret<\/p>\n","overskrift":"Min Titel","modtagere":"10150817","fristDato":"09-04-2019","afsenderCvr": "10150817"}' https://api.virk.dk/calendar/1/frister/10

Example JSON response if frist was updated

{
"fristId": 10,
"afsenderCvr": "10150817",
"afsenderNavn": "Erhvervsstyrelsen",
"fristDato": "09-04-2019",
"overskrift": "Min Titel",
"modtagere": "",
"beskrivelse": "<p>Min beskrivelse opdateret</p>\n",
"isLaest": false,
"isOpfyldt": false,
"isSlettet": false

}


DELETE: Delete a Frist

URL

https://api.virk.dk/calendar/1/frist/{id}

                                                               | true - when **'AUTOTEXTANDCOMMENT'** | Max: 10.000 chars                               | String |

Example request

$ curl -X DELETE -H "Accept: application/json" -H "Content-Type: application/json"
  -d http://localhost:8891/virkservices/api/calendar/1/frister/10

Example JSON response if the frist was deleted

{
   "status":"OK",
   "code":200,
}