# Checking the API status

First we load the package

    library(dawaR)

## Use `status_check()` to assert whether the services are available

`status_check()` is built to provide a simple `cli` response in the R console with the current status of the API.

    status_check()
    #> ✖ WMS - forvaltning2 and sdfekort.dk are not operational

It is also possible to return a dataframe specifying the individual status of each service provided by the government entity that maintains DAWA. This is particularly useful if you would like to use it in any further analyses.

    status_check(return_df = TRUE)
    #> ✖ WMS - forvaltning2 and sdfekort.dk are not operational
    #>              service status
    #> 1           Adresser     OK
    #> 2         Arkiv kort     OK
    #> 3 Dataforsyningen.dk     OK
    #> 4               FTPS     OK
    #> 5            Gsearch     OK
    #> 6 WMS - forvaltning2   Down
    #> 7        sdfekort.dk   Down

You can also use the `status_check(error_if_unavailable = TRUE)` as a test to stop your script if one of the services is currently unavailable.

For more granular handling of connection errors, you can use `connection_check()` which simply returns a logical value to help you determine how to handle the connection.

## DAWA will be phased out

The government entity that maintains the Danish Web Address API has disclosed that the API will be phased out at some point. When that time comes, this package will become deprecated and I will have another package ready to provide the same functionality. The service that is to replace DAWA is called Datafordeleren (The Data Distribution) and is in the works. Some functionality in relation to The Central Register of Buildings (BBR) has already been moved to the new service.

If you know how to read danish (or use machine-translation) you can keep yourself up to date on this page.

But no worries! It does not sound like the shutdown of DAWA will happen anytime soon or without due notice. Any updates will be written below.

### Change history

- The Central Register of Buildings has been moved effective: 03-April-2024