|
|
(4 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| = Introduction = | | = 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.
| + | To be able to send thousands of invoices a day, we implemented a proxy called ''Onea Transfer''. |
| | | |
| = API = | | = API = |
Line 7: |
Line 7: |
| The ScanPRO Transfer API endpoint is ''<nowiki>https://transfer.onea.be</nowiki>''. Please note that only ''HTTPS'' is available. | | The ScanPRO Transfer API endpoint is ''<nowiki>https://transfer.onea.be</nowiki>''. Please note that only ''HTTPS'' is available. |
| | | |
− | == Upload e-Invoice ==
| + | More information about the API can be found here: https://dev.onea.be/api/oneatransfer/ |
− | | |
− | '''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 ''<nowiki>https://myapp.com/einvoice/poke</nowiki>'', then the following URL will be called for UUID ''123'': ''<nowiki>https://myapp.com/einvoice/poke/123</nowiki>''.
| |
− | | |
− | === Example ===
| |
− | | |
− | 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/incoming</nowiki>
| |
− | | |
− | Returns:
| |
− | | |
− | <nowiki>{"uuid":"AD85DF83-F113-46D7-B07A-28FD943A487A"}</nowiki>
| |
− | | |
− | == 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''.
| |
− | | |
− | === Example ===
| |
− | | |
− | An example to fetch the e-Invoice status using cURL:
| |
− | | |
− | <nowiki>curl -H "Content-Type: application/json" "https://transfer.onea.be/restv1/einvoice/status/06aa265c-54b3-4d04-a585-baea0b7d41dc"</nowiki>
| |
− | | |
− | Returns when not yet processed:
| |
− | | |
− | <nowiki>{"status":"PENDING","id":null}</nowiki>
| |
− | | |
− | Returns when processed:
| |
− | | |
− | <nowiki>{"status":"DONE","id":"0123456789"}</nowiki>
| |
− | | |
− | Returns when failed:
| |
− | | |
− | <nowiki>{"status":"FAILURE","id":"0123456789","message":"Error on field 'INVNR' and SUPPCODE': Possible duplicate document with number '789' and supplier/customer 'AAA IC multi (549)' (Document 132, 456)"}</nowiki>
| |