Send outbound messages to PEPPOL recipients
POST /outbox
For each message:
- Check what processes and document types the receiver accepts.
- Generate an PEPPOL document that conforms to the CustomizationID and ProfileID the receiver accepts.
- Validate the contents according to the CEN BII and local/national rules
- Send file using the "outbox" resource with correct sender, receiver, process, document and channel identification.
- Inspect the status of the transmission. The status is returned immediately as part of the response from the server
- Optional : Re-read status later (after an hour or so) to get the DELIVERED timestamp and UUID of the transport
You must use "multipart/form-data", which means that all parameters should be sendt as form-data and not as http-headers.
The following is an example illustrating how you may send the file named "invoice42.xml" using cURL.
curl -i -u %lt;username>:%lt;password>
-H 'Accept: application/xml'
-F 'file=@invoice_bis30_ubl.xml'
-F 'SenderID=0192:976098897'
-F 'RecipientID=0192:987601787'
-F 'ChannelID=PEPPOL'
-F 'ProcessID=urn:fdc:peppol.eu:2017:poacc:billing:01:1.0'
-F 'DocumentID=urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1'
https://ap-test.unit4.com/outbox
Form field name |
Value |
Example |
SenderID |
The PEPPOL participant identity of the sender |
0192:976098897 |
RecipientID |
The PEPPOL participant identity of the receiver |
0192:986252932 |
ChannelID |
User specified classification of document (works much like a tag or category) |
PEPPOL |
DocumentID |
Full PEPPOL document type identifier that identifies the document format and its customization |
|
ProcessID |
Full business process/profile in which this document shall be used |
|
file |
File actual XML payload containing the business document. |
... xml-data ... |
Uploads the supplied file using the given attributes. The message is placed into the outbound queue for transmission.
Response on success:
HTTP/1.1 201 Created
Content-Type: application/xml
Location: https://ap-test.unit4.com/outbox/19
Response on error:
HTTP/1.1 400 Bad Request
Content-Type: text/plain;charset=UTF-8
Wrong documentId value: urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0
List of messages in the outbox
GET /outbox
Retrieves a list of messages which have not yet been transferred into the PEPPOL network.
HTTP/1.1 200 OK
Content-Type: application/xml
Retrieve list of inbound invoices
GET /inbox
- Retrieve list of XML documents from the "inbox" resource
- For each document in the returned list:
- Download document using the URL which is provided in the returned list
- Mark message as received, using the REST call
Response: a list of messages residing in the "inbox". Each item in the list contains meta data about the message
along with the URL which should be used to retrieve the message:
HTTP/1.1 200 OK
Content-Type: application/xml
Retrieve a single message in the inbox
If you know the message identification, i.e. you wish to check the status of a message having an id of 4:
GET /inbox/4
Reponse: the meta data details for the given message:
HTTP/1.1 200 OK
Content-Type: application/xml
If message with given number doesn't exist, 204 code will be returned.
Marking a message as read
To prevent the message from appearing in the list of unread messages residing in the "inbox", you need to mark it as
"read":
POST /inbox/4/read
curl -X POST https://<username>:<password>@ap-test.unit4.com/inbox/4/read
HTTP/1.1 200 OK
Content-Type: application/xml
This will set the "delivered" timestamp on the message to the current time stamp on the server. Consequently, this
messages will no longer appear in the list of messages returned by "GET /inbox".
Searching for messages
All messages sent and received are available under the resource /messages
You may search messages based on one or more of the following criteria:
-
sent - The time the message was sent to the access point, can be used with any of \<=, =, \<, >, =>
-
sender - The Peppol participant Id of the sender
-
receiver - The Peppol participant Id of the reciever
-
direction - IN or OUT
For example:
GET /messages?sent='>2012-01-30'&sender='0192:976098897'&direction=OUT
With URL encoding, this would look like:
GET /messages?sent='%3E2012-01-30'&sender='0192:976098897'&direction=OUT
Response: a list of messages.
HTTP/1.1 200 OK
Content-Type: application/xml
WARNING
When accessing the /inbox
, /outbox
or /messages
resource, only a maximum of 25 records will be retrieved.
If there are more than 25 messages a navigation element will provide links to the previous and next page.
E.g. Accessing third page (https://ap-test.unit4.com/messages?index=3
) will result in below output.
Checking if a recipient is connected to the PEPPOL network
In order to determine whether a recipient is connected to the PEPPOL network, you may check using their PEPPOL participant identification:
GET /directory/0192:976098897
The response will contain HTTP/1.1 200 OK if the recipient is connected to the Peppol network, otherwise the response will be HTTP/1.1 204 NOT FOUND:
Looking up which document types and busines profiles the recipent accepts
In order to send any document to a given recipient, the proper PEPPOL Document Type Identifier and PEPPOL Process Type Identifier must be included in the XML message and provided in the message headers.
You can fetch the list of accepted values by making GET request to the /directory
resource specifying the PEPPOL Participant Identification followed by the document LocalName (i.e. 'Invoice', 'CreditNote', 'Order' etc)
GET /directory/0192:810017902/Invoice
NOTE! There can be several possible document types for the supplied "local name" and there might be rules when it comes to which you should use. For cross-border you might have to use the international BIS variant and within a country you might have to select a more specific local variant like EHF (ie, this is mandatory between Norwegian participants).
If there are no accepted document types, 204 code will be returned.
Statistics
In order to monitor the current state of an account a simple get request can be made to obtain the current statistics for the account:
GET /statistics
The response will contain HTTP/1.1 200 OK followed by an XML document containing information regarding the account
All time stamps are in the ISO8601 standard format