Send Digital Mail with Attachments
To send digital mail with attachments you send as you normally would, but in addition to specifying a primary-document you must also list the attachments you wish to send.
Request
POST https://api.digipost.no/messages HTTP/1.1
X-Digipost-UserId: 497013
Date: Wed, 07 Dec 2016 14:47:08 GMT
Accept: application/vnd.digipost-v8+xml
X-Content-SHA256: cZM1trDPKy8/ygP8+LOllNv6S78AntQrZBCE+cEcJos=
X-Digipost-Signature: RAdz6PqMVSQn/+0LBcRAaih8Ic9R0ccBL0aTgg1sA0SpUwje1HbM8ZeH8uxjIKXv2OLnUs/w6uONl51SzxLdF/TUGZWRMEx3063KvFdzOIyAylkRTCKo9F1ulKix0fmg0d9/WU3hC3ayPXyja9D1AbMOSb1lOdCnxDL46u28EgO1r09b27N653as4I2GQPgJJAakcCme8JDvRaxxidKVn2OCXSb10UHY/GYGtt2Xda5AtohDvKdiOZRtP31sPaLKrt+eczDDwuZoM8mNId1mdOagjnw3NSHUZj+c38M2hqUldZCHrc9LUbhnihuhvB6XiIfzJTA6Z5oLZ8+nGk7Kpg==
Content-Type: multipart/vnd.digipost-v8+xml; boundary=6dc66a32-2453-44dd-8cac-cf54b3b1d0b0
Host: api.digipost.no
Content-Length: 2604
Expect: 100-continue
Connection: Keep-Alive
--6dc66a32-2453-44dd-8cac-cf54b3b1d0b0
Content-Type: application/vnd.digipost-v8+xml
Content-Disposition: attachment; filename="message"
<?xml version="1.0" encoding="utf-8"?>
<message xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.digipost.no/schema/v8">
<recipient>
<personal-identification-number>01043100358</personal-identification-number>
</recipient>
<primary-document>
<uuid>6d99008e-2672-4b55-9b09-996b09a06e47</uuid>
<subject>primary-pdf-document</subject>
<file-type>pdf</file-type>
<authentication-level>PASSWORD</authentication-level>
<sensitivity-level>NORMAL</sensitivity-level>
</primary-document>
<attachment>
<uuid>2bade07d-774f-4cbb-a832-1299f2373a71</uuid>
<subject>attachment-text-document</subject>
<file-type>txt</file-type>
<authentication-level>PASSWORD</authentication-level>
<sensitivity-level>NORMAL</sensitivity-level>
</attachment>
</message>
--6dc66a32-2453-44dd-8cac-cf54b3b1d0b0
Content-Type: text/plain
Content-Disposition: attachment; filename=6d99008e-2672-4b55-9b09-996b09a06e47
%PDF-1.4
%
...
...
...
1 07
%%EOF
--6dc66a32-2453-44dd-8cac-cf54b3b1d0b0--
Content-Type: text/plain
Content-Disposition: attachment; filename=2bade07d-774f-4cbb-a832-1299f2373a71
Text in actual text document...
--6dc66a32-2453-44dd-8cac-cf54b3b1d0b0--
Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message-delivery xmlns="http://api.digipost.no/schema/v8">
<delivery-method>DIGIPOST</delivery-method>
<sender-id>497013</sender-id>
<status>DELIVERED</status>
<delivery-time>2016-12-07T08:45:32.675+01:00</delivery-time>
<primary-document>
<uuid>6d99008e-2672-4b55-9b09-996b09a06e47</uuid>
<subject>primary-pdf-document</subject>
<file-type>pdf</file-type>
<authentication-level>PASSWORD</authentication-level>
<sensitivity-level>NORMAL</sensitivity-level>
<pre-encrypt>false</pre-encrypt>
<content-hash hash-algorithm="SHA256">5o0RMsXcgSZpGsL7FAmhSQnvGkqgOcvl5JDtMhXBSlc=</content-hash>
</primary-document>
<attachment>
<uuid>2bade07d-774f-4cbb-a832-1299f2373a71</uuid>
<subject>attachment-text-document</subject>
<file-type>txt</file-type>
<authentication-level>PASSWORD</authentication-level>
<sensitivity-level>NORMAL</sensitivity-level>
<pre-encrypt>false</pre-encrypt>
<content-hash hash-algorithm="SHA256">9d3b24881ee26d8db0b0f79f866c49521938ba88717f8ddd722ff126f70d36e1</content-hash>
</attachment>
</message-delivery>