Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ licenseUrl: http://www.apache.org/licenses/LICENSE-2.0

baseurl: "/digipost-api-client-java"

currentVersion: "16.x"
versions: ["16.x", "15.x", "13.x", "11.x", "10.x", "9.0", "8.0"]
currentVersion: "18.x"
versions: ["18.x", "17.x", "16.x", "15.x", "13.x", "11.x", "10.x", "9.0", "8.0"]
deprecatedVersions: ["8.0", "9.0", "10.x", "11.x", "13.x"]

collections:
Expand All @@ -34,6 +34,12 @@ collections:
v16_x:
output: true
permalink: /v16.x/
v17_x:
output: true
permalink: /v17.x/
v18_x:
output: true
permalink: /v18.x/

# list of additional links on the right of the top menu
headerLinks:
Expand Down
2 changes: 1 addition & 1 deletion docs/_v10_x/1_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ client.createMessage(message)
```java
PersonalIdentificationNumber pin = new PersonalIdentificationNumber("26079833787");

// The time the SMS is sent out can be based on time after letter is delivered or a specific date. This example specifies that the SMS should be sent out one day after the letter i delivered.
// The time the SMS is sent out can be based on time after letter is delivered or a specific date. This example specifies that the SMS should be sent out one hour after the letter i delivered.
Document primaryDocument = new Document(UUID1, "Document subject", FileType.PDF, null, new SmsNotification(1), null, AuthenticationLevel.PASSWORD, SensitivityLevel.NORMAL);

Message message = Message.MessageBuilder.newMessage(UUID2, primaryDocument)
Expand Down
2 changes: 1 addition & 1 deletion docs/_v11_x/2_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ PersonalIdentificationNumber pin = new PersonalIdentificationNumber("26079833787

// The time the SMS is sent out can be based on time after letter is delivered
// or a specific date. This example specifies that the SMS should be sent out
// one day after the letter i delivered.
// one hour after the letter i delivered.
Document primaryDocument = new Document(UUID1, "Document subject", FileType.PDF, null,
new SmsNotification(1), null,
AuthenticationLevel.PASSWORD, SensitivityLevel.NORMAL);
Expand Down
2 changes: 1 addition & 1 deletion docs/_v13_x/2_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ PersonalIdentificationNumber pin = new PersonalIdentificationNumber("26079833787

// The time the SMS is sent out can be based on time after letter is delivered
// or a specific date. This example specifies that the SMS should be sent out
// one day after the letter i delivered.
// one hour after the letter i delivered.
Document primaryDocument = new Document(UUID1, "Document subject", FileType.PDF, null,
new SmsNotification(1), null,
AuthenticationLevel.PASSWORD, SensitivityLevel.NORMAL);
Expand Down
2 changes: 1 addition & 1 deletion docs/_v15_x/2_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ PersonalIdentificationNumber pin = new PersonalIdentificationNumber("26079833787

// The time the SMS is sent out can be based on time after letter is delivered
// or a specific date. This example specifies that the SMS should be sent out
// one day after the letter i delivered.
// one hour after the letter i delivered.
Document primaryDocument = new Document(UUID1, "Document subject", FileType.PDF, null,
new SmsNotification(1), null,
AuthenticationLevel.PASSWORD, SensitivityLevel.NORMAL);
Expand Down
2 changes: 1 addition & 1 deletion docs/_v16_x/2_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ PersonalIdentificationNumber pin = new PersonalIdentificationNumber("26079833787

// The time the SMS is sent out can be based on time after letter is delivered
// or a specific date. This example specifies that the SMS should be sent out
// one day after the letter i delivered.
// one hour after the letter i delivered.
Document primaryDocument = new Document(UUID1, "Document subject", FileType.PDF, null,
new SmsNotification(1), null,
AuthenticationLevel.PASSWORD, SensitivityLevel.NORMAL);
Expand Down
2 changes: 1 addition & 1 deletion docs/_v16_x/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
identifier: index
layout: default
redirect_from: /
redirect_from:
---

<!-- Documentation -->
Expand Down
71 changes: 71 additions & 0 deletions docs/_v17_x/1_client_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Instantiate and configure the client
identifier: client_config
layout: default
---

### Install

The client library is available on the [Maven Central Repository](https://central.sonatype.com/artifact/no.digipost/digipost-api-client-java).
Copy the `<dependency>`-snippet from that website and put it in your pom.xml file.
Make sure to use the latest version available.

This client requires Java 11 and `jakarta.xml-bind`.

### Configure for production use

To instantiate the client instance you need to supply your assigned _broker ID_, which
is set up to be permitted to integrate with the Digipost API. In addition, you must create
a `Signer` instance, e.g. by using a `.p12` file to read the private key to use for signing
the API requests.

```java
SenderId senderId = SenderId.of(123456);

Signer signer;
try (InputStream sertifikatInputStream = Files.newInputStream(Paths.get("certificate.p12"))) {
signer = Signer.usingKeyFromPKCS12KeyStore(sertifikatInputStream, "TheSecretPassword");
}

DigipostClient client = new DigipostClient(
DigipostClientConfig.newConfiguration().build(), senderId.asBrokerId(), signer);
```

This example will configure the client to communicate with the regular Digipost production
environment.


### Other environments

If you have access to other environments, this can be configured using
`DigipostClientConfig`, e.g:

```java
URI apiUri = URI.create("https://api.test.digipost.no");
DigipostClientConfig config = DigipostClientConfig.newConfiguration().digipostApiUri(apiUri).build();
```

#### Norsk Helsenett (NHN)

The Digipost API is accessible from both internet and Norsk Helsenett (NHN). Both entry points use
the same API, the only difference is the base URL.

```java
URI nhnApiUri = URI.create("https://api.nhn.digipost.no");
DigipostClientConfig config = DigipostClientConfig.newConfiguration().digipostApiUri(nhnApiUri).build();
```

### Custom HTTP client

Since version 17, the client uses Apache HttpClient 5 internally. If you need control over the
underlying HTTP client (e.g. connection pooling or proxy settings), you can supply your own
`HttpClientBuilder`:

```java
HttpClientBuilder clientBuilder = HttpClientFactory.createDefaultBuilder();

DigipostClient client = new DigipostClient(
DigipostClientConfig.newConfiguration().build(), senderId.asBrokerId(), signer, clientBuilder);
```


Loading
Loading