Difference between revisions of "Onea Transfer"
(init) |
(split up e-Invoice to incoming/outgoing) |
||
Line 9: | Line 9: | ||
== Upload e-Invoice == | == Upload e-Invoice == | ||
− | '''PATH''': ''/restv1/einvoice'' | + | '''PATH''': ''/restv1/einvoice/{type}'' |
'''METHOD''': ''POST'' | '''METHOD''': ''POST'' | ||
Line 16: | Line 16: | ||
'''DATA''': ''apiKey, eInvoiceData, callbackURL'' | '''DATA''': ''apiKey, eInvoiceData, callbackURL'' | ||
+ | |||
+ | Where ''type'' is either ''incoming'' or ''outgoing''. | ||
Both ''apiKey'' and ''eInvoiceData'' are strings and mandatory fields, ''callbackURL'' is optional. The API key(s) will be provided by Onea and is strictly personal. The e-Invoice data field must be Base64 encoded. | Both ''apiKey'' and ''eInvoiceData'' are strings and mandatory fields, ''callbackURL'' is optional. The API key(s) will be provided by Onea and is strictly personal. The e-Invoice data field must be Base64 encoded. | ||
Line 27: | Line 29: | ||
An example to upload an e-Invoice using cURL: | An example to upload an e-Invoice using cURL: | ||
− | <nowiki>curl -H "Content-Type: application/json" -d '{"apiKey":"2B98577D-49DB-4E86-9DF9-F8F6726725AE","eInvoiceData":"aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==","callbackURL":"https://myapp.com/einvoice/poke"}' https://transfer.onea.be/restv1/einvoice</nowiki> | + | <nowiki>curl -H "Content-Type: application/json" -d '{"apiKey":"2B98577D-49DB-4E86-9DF9-F8F6726725AE","eInvoiceData":"aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==","callbackURL":"https://myapp.com/einvoice/poke"}' https://transfer.onea.be/restv1/einvoice/incoming</nowiki> |
Returns: | Returns: |
Revision as of 08:41, 7 April 2017
1 Introduction
Sending thousands of invoices a day would have a negative impact on the stability of ScanPRO, and can be solved by a proxy. The goal of the proxy - Onea Transfer - is to take away the load on ScanPRO.
2 API
The ScanPRO Transfer API endpoint is https://transfer.onea.be. Please note that only HTTPS is available.
2.1 Upload e-Invoice
PATH: /restv1/einvoice/{type}
METHOD: POST
TYPE: JSON
DATA: apiKey, eInvoiceData, callbackURL
Where type is either incoming or outgoing.
Both apiKey and eInvoiceData are strings and mandatory fields, callbackURL is optional. The API key(s) will be provided by Onea and is strictly personal. The e-Invoice data field must be Base64 encoded.
When your request was successfully processed, the system will return a 200 OK status code with payload uuid. With this UUID you can later on fetch the document ID.
If you supply a callback URL, it will be notified of any change. That way you don't need to poll, but only fetch the status after you received such notification. Please note the callback URL will be appended with the UUID. If you supply the callback URL https://myapp.com/einvoice/poke, then the following URL will be called for UUID 123: https://myapp.com/einvoice/poke/123.
2.1.1 Example
An example to upload an e-Invoice using cURL:
curl -H "Content-Type: application/json" -d '{"apiKey":"2B98577D-49DB-4E86-9DF9-F8F6726725AE","eInvoiceData":"aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==","callbackURL":"https://myapp.com/einvoice/poke"}' https://transfer.onea.be/restv1/einvoice/incoming
Returns:
{"uuid":"AD85DF83-F113-46D7-B07A-28FD943A487A"}
2.2 Status
PATH: /restv1/einvoice/status/{uuid}
METHOD: GET
TYPE: JSON
No API key is needed here; the authentication is implied by the UUID you got when you uploaded the e-Invoice. The UUID is a path parameter in your endpoint.
When your request was successfully processed, the system will return a 200 OK status code with payload status, id. The current status of the document is shown in the status field, and when DONE, the ID field will contain the ScanPRO document ID. All possible status codes are PENDING, DONE, FAILED.
2.2.1 Example
An example to fetch the e-Invoice status using cURL:
curl -H "Content-Type: application/json" "https://transfer.onea.be/restv1/einvoice/status/06aa265c-54b3-4d04-a585-baea0b7d41dc"
Returns when not yet processed:
{"status":"PENDING","id":null}
Returns when processed:
{"status":"DONE","id":"0123456789"}