The API interface associated with the DbConnector delivers some of the features of the app as an intranet web service.
The web service is available with XML-based REST API management.
The API is available at the following entry point. The server name depends on the environment of the local intranet.
POST | GET http://server/dbconnector/api/v1/
The billing API is asynchronous. Requests submitted will be placed in a queue. There is a separate API to call enquire about the state of processing. Responses are in XML.
Content
The wait list is emptied by a timed processor. New items are to be added to the queue during processing will be added to the next processing period.
The authentication data should be sent in the HTTP header at every API call.
Header parameters pkod:SajatSupPartnerKod
lickod:SajatSupLicKod
The data can be found in the company's SUP license datasheet.
- pkod - SUP partner code
- lickod - SUP licence code
API test
GET | POST http://server/dbconnector/api/v1/test
.
The purpose of this call is to test the API's availability. This test can be done by any browser. For complex testing, use CURL.
Body parameter (optional raw data) dummy
Result XML - <Success> :
true | false XML - <StatusCode> :
The HTML status code is more detailed.
Normally, we only test the existence of the API. This is almost the same method as the one called by the browser title bar.
CURL.EXE ^ -X GET ^ http://server/dbconnector/api/v1/test
You must also provide credentials for the full testing. In case of success, a version number is the answer.
CURL.EXE ^ -X POST ^ http://server:8080/dbconnector/api/v1/test ^ -H pkod:SajatSupPartnerKod ^ -H lickod:SajatSupLicKod
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DbConnectorResponse> <Success>true</Success> <StatusCode>200</StatusCode> <Message>API build: 1.0.6536M (2018.08.09. 16:07:30) DbConnector DLL: 15.1 (2018.08.01. 8:16:32)</Message> </DbConnectorResponse>
Invoice Submission
POST http://server/dbconnector/api/v1/postxml
The aim of the call is to make the module of the Dbconnector of the SUP System, which is based on an externally produced invoicing command in the form of the Outgoing invoices to import XML scheme, accessible on a webpage as well.
Parameter (required) XML :
The ivoicing request (any invoice attachments must be pre-uploaded)
Result XML - <Token> :
In case of successful submission, the received data should be retained. The result of the processing can be requested with this ID.
CURL.EXE ^ -X POST ^ http://server:8080/dbconnector/api/v1/postxml ^ -H pkod:SajatSupPartnerKod ^ -H lickod:SajatSupLicKod ^ -H "Content-Type: text/html; charset=UTF-8" ^ --data-ascii @testUpload.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DbConnectorResponse> <Success>true</Success> <StatusCode>200</StatusCode> <Token>7085BEEC-93B0-4FE1-88BB-F531EDAC38D6</Token> </DbConnectorResponse>
Invoice attachment upload
POST http://server/dbconnector/api/v1/upload
An attachment can be optionally uploaded for the invoice. The following file formats can be uploaded: JPG, PDF. If the prepared invoice is in PDF format, the attachments are embedded in a PDF.
Attachments must be uploaded to the server before the invoice XML is submitted. The identifiers (tokens) received in response must be placed in a comma-listed list in <Elojegyzett_Szamlak><Szamlak><Szamla><Csatolmanyok> data tag.
CURL.EXE ^ -X POST ^ http://server:8080/dbconnector/api/v1/upload ^ -H pkod:SajatSupPartnerKod ^ -H lickod:SajatSupLicKod ^ -F file=@testupload.jpg
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DbConnectorResponse> <Success>true</Success> <StatusCode>200</StatusCode> <Message>File feltöltés sikeres</Message> <Token>74cc7200-b9fc-4fd8-a1cf-8942c09afc35</Token> </DbConnectorResponse>
Enquiry about process status
GET http://server/dbconnector/api/v1/getstatus
The purpose of this call is to enquire about the processing status of an XML document submitted to the processing queue. To identify a request, a token that is returned in the XML should be used.
In case of successful processing, it returns the number in the SUP system (log | invoice number) as well as the PDF image of the invoice- encoded in base 64 format.
Parameter (required) token :
The token received when submitting XML.
Result XML - <BizonylatAzon> :
Identifier of the completed invoice in the SUP system (log | invoice number). XML - <PdfDocument> :
The PDF file of the completed invoice (if the SUP setting is correct).
CURL.EXE ^ -X GET ^ http://server:8080/dbconnector/api/v1/getstatus?token=B03D8188-2159-4174-A866-E214988DFB2A ^ -H pkod:SajatSupPartnerKod ^ -H lickod:SajatSupLicKod
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DbConnectorResponse> <Success>false</Success> <StatusCode>290</StatusCode> <Message>A tetel feldolgozasra var</Message> </DbConnectorResponse>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DbConnectorResponse> <Success>true</Success> <StatusCode>200</StatusCode> <BizonylatAzon>499|DBC0001/18</BizonylatAzon> </DbConnectorResponse>
Response XML
The response to the API call is generated by a <DbConnectorResponse> schema.
Data members
Success | In case of sucessful processing, true, otherwise false |
StatusCode | In case of failed processing, more detailed information will be returned. |
Message | In case of failed processing, text information will be returned in accordance with StatusCode response. |
Token | When submitting a request, this identifier can be used to retrieve status information from queue. |
BizonylatAzon | When invoice instructions are submitted, and the processing is successful, the invoice can be found on the given ID in the SUP system |
PdfDocument | When invoice instructions are submitted and the processing is successful, the completed PDF image of the invoice is encoded in base64 format. Additional settings are required on the server-side to receive the PDF image of the invoice. In absence of these, only the BizonylatAzon information is returned. |
Error codes
- 200 OK
- 290 Not yet processed
- 401 Unauthorized
- 404 Not Found
- 490 Auth param missing
- 491 Body or param missing
- 492 XML ERROR
- 493 Already exist
- 494 Too long time not processed
- 495 Error on processing
- 499 Other error
- 590 INI error
- 591 Database connect error
- 592 Other Exception
Client Implementation
The first step in client implementation is to test the functionality of the API. The testing can be done in two modes.
- API url availability check
- API full test
To test the function, the widely used CURL can be used. Different browser extensions can be also used.
Using outside of the intranet
Although API is basically used inside the intranet, it is possible to use it from the Internet by creating adequate security conditions.
To test the API, QSoft Kft. made a web-based test-interface, which is available on this site: http://dbconnector-apitest.sup.hu
The API test is also available on the Internet at http://dbconnector-apitest.sup.hu/api.
Identification codes required for use and testing, will be generated after prior consultation.
Error handling
API access error
Authentication error