Difference between revisions of "Onea Transfer"

From 1Archive help
Jump to: navigation, search
(Added API key validation)
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/index.html
 
 
'''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 (POST) 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>
 
 
 
== API Key Validation ==
 
 
 
{{info|This is a protected endpoint. To access, you'll need to apply at info@onea.be}}
 
 
 
'''PATH''': ''/restv1/apikey/{apiKey}''
 
 
 
'''METHOD''': ''GET''
 
 
 
'''TYPE''': ''JSON''
 
 
 
The apiKey is a path parameter in your endpoint.
 
 
 
When your request was successfully processed, the system will return a ''200 OK'' status code with payload "apiKey, environment, active".
 
 
 
=== Example ===
 
 
 
An example to validate an API key using cURL:
 
 
 
<nowiki>curl -H "Content-Type: application/json" "https://transfer.onea.be/restv1/apikey/8D7832F2-6E10-42ED-8555-C75BF370F878"</nowiki>
 
 
 
Returns when all OK:
 
 
 
<nowiki>{"apiKey":"8D7832F2-6E10-42ED-8555-C75BF370F878","environment":"test-env","active":true}</nowiki>
 
 
 
Returns when no access:
 
 
 
<nowiki>401 Unauthorized</nowiki>
 
 
 
Returns on invalid API key:
 
 
 
<nowiki>404 Not Found</nowiki>
 

Revision as of 15:17, 9 August 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.

More information about the API can be found here: https://dev.onea.be/api/oneatransfer/index.html