## Headers

The S2S server is configured to require a set of custom headers in each HTTP call. To make a successful request, you are responsible for configuring your HTTP client to provide these headers in your calls. This chapter provides an overview of the expected values and possible issues that you may encounter.

Header | Required | Format
--- | --- | ---
Tinglysning-Message-ID | Yes | uuid:[uuid-v4]
Tinglysning-Relates-To | No | String

### Tinglysning-Message-ID

The land registry message ID is a random UUIDv4 generated by the client before sending a new request to the S2S endpoint. This header is used to uniquely identify the full request-response process, and therefore it is required in every request. It also helps both parties debug problems more easily.

#### Header structure

The header consists of the prefix "uuid:" followed by a randomly generated UUIDv4. The header must not contain uppercase letters.

Header name | Header value
--- | ---
Tinglysning-Message-ID | uuid:44b147ff-b221-43f7-be45-cdb55f085413

#### Expected errors

If the header is not provided, you can expect HTTP status `400 Bad Request` with this XML response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Fejl xmlns="http://rep.oio.dk/tinglysning.dk/schema/fault/1/">
        <ns2:faultcode xmlns="" xmlns:ns2="http://rep.oio.dk/tinglysning.dk/schema/fault/1/">Client</ns2:faultcode>
        <faultstring>Følgende krævede header var ikke tilstede: Tinglysning-Message-ID</faultstring>
    </Fejl>

If the header has an invalid structure, expect HTTP status `400 Bad Request` with this XML response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Fejl xmlns="http://rep.oio.dk/tinglysning.dk/schema/fault/1/">
        <ns2:faultcode xmlns="" xmlns:ns2="http://rep.oio.dk/tinglysning.dk/schema/fault/1/">Client</ns2:faultcode>
        <faultstring>Det modtagne MessageID er i invalidt format: uuid:ce01bb6d-3479-4975-8ab5-. Et MessageID skal være på formen uuid:[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}</faultstring>
    </Fejl>

### Tinglysning-Relates-To

Sometimes your application needs to provide additional reference information in the call. You can use the "relates to" header for this purpose. This header is not required and expects a string value.

Header name | Header value
--- | ---
Tinglysning-Relates-To | CASE-2024-001

### Content-Type

All endpoints expect users to provide their request body in XML format. API is configured to receive XML and will also respond with XML. If left out, this header will be filled out automatically but you can also set it up manually.

Header name | Header value
--- | ---
Content-Type | application/xml

#### Expected errors

Providing a different value will result in request rejection with HTTP status `415 Unsupported Media` Type and this message:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Fejl xmlns="http://rep.oio.dk/tinglysning.dk/schema/fault/1/">
        <ns2:faultcode xmlns="" xmlns:ns2="http://rep.oio.dk/tinglysning.dk/schema/fault/1/">Client</ns2:faultcode>
        <faultstring>Ikke understøttet Content-Type: 'test/test'. Indstil venligst 'Content-Type'-headeren til 'application/xml'.</faultstring>
    </Fejl>

#### Reference implementation

Given the correct SSL context and HTTP client setup (look at the Reference OCES implementation), you can create a successful call using the provided example from the Java reference client:

    1
    Unresolved directive in headers.adoc - include::{javaDir}/ExampleRequest.java[]