Appendix D - REST API

The REST interface for ReglaWebService is a wrapper around the SOAP interface already outlined in this document.

All REST calls are made as a HTTP POST request with the parh https://www.regla.is/fibs/RestAPI2019/{function} where {function] is replaced with the corresponding SOAP method.
The method name is case sensitive.

The body of the POST request should contain a JSON text object that contains all the parameters of the request.

The request must have the content-type application/json.
In case of a complex type parameter the JSON will be converted directly to that complex type (ProductInvoice etc.).

It is important that the POST request body is UTF-8 encoded if there are non-english letters in the JSON.

APIResponse Class

The response to every POST request is an APIResponse object.

Field Type Req. Description
Result MethodResult Yes A valid object of type MethodResult.
Returned TObject No A valid object of type T, this is the object returned by the SOAP function.
OutParameters Object No This object will depent on the type of out parameters that the SOAP function returns.
timeRun long No The time in ms that the request took to finish.

Example

Following are examples of how you implement the client side of a REST connection.
All Python code examples are using the Request python package (http://docs.python-requests.org) and Python version 3.7.

Login

The login function takes in 2 parameters, the username and the password.
The response then returns the Result object, the Returned object, and any out-parameters that might have been included in the function.

POST Request bodyResponse

The Login request is returned with a login token and information about the running time of the request.

Python Example

GetPaymentMethod

This function takes a login token for a verification and returns available payment methods.

POST Request body

Response

Python Example

GetCustomer

Gets a customer by CustomerNumber.
Provide a login token like with other methods.

Post request body

Response

Python Example

CreateInvoice

This method will create an invoice by sending in a complex type Invoice as JSON string.

POST Request body JSON

Response

Python Example

CreateInvoice.py


Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us