Using the Sage Remote Viewer Server

The Sage Remote Viewer Server (SRVS) is a stand-alone executable which provides a built-in mini web server that responds to specific requests and returns the data in Javascript Object Notation (JSON) format.

To install simply double-click the setup.exe to install the application. Once installed you run up the application and will see this screen;

Sage 50 Server

Sage 50 Server

If you click on the ‘Settings’ tab this is where we specify our connection to the Sage Line 50 data.

Sage Remote Viewer Server Settings

Sage Remote Viewer Server Settings

The first thing we do is specify the Sage ODBC driver. You will see a list, typically there is only one ODBC driver per version of Sage Line 50. In this case we have selected ‘SageLine50v13’ which is in fact Sage 50 2007, version 14 is Sage 50 2008 and so on.

Now we need to tell the application where the ‘home’ directory is. For versions of Line 50 prior to 2009 this is typically C:\Program Files\Sage\Accounts but for 2009 onwards this will typically be C:\Documents and Settings\All Users\Application Data\Sage\Accounts\2009. If this is set correctly when you click on the drop down box for ‘Company’ you should see a list of companies. If you do not then the home directory has been specified incorrectly.

Now simply enter a valid Sage username and password and click ‘Connect’. If all is well you should see a message saying the connection was successful and all the sign-on details have now been disabled to prevent accidentally changing them. If you do need to make any changes here you can simply click the ‘Disconnect’ button.

Once you have connected you can then click on ‘Start Server!’ to put the server into listening mode. If the Sage connection is not valid the server will not start. You can click on the close (X) button in the top right which will then minimise the server into the system tray in the bottom right so it will run unobtrusively in the background.

Testing the server

If you have connected to Sage and the server is running you should now be able to test that the server will actually respond to requests. Open up a browser window and type the following;

http://localhost:88/get/customers?index=A

You should now see a list of customers beginning with ‘A’ on the screen. If you do not or get any other error there is an issue with the server. If you want to do anymore testing here are a list of valid commands you can send to the server from a browser;

To get all sales ledger accounts beginning with ‘B’

http://localhost:88/get/customers?index=B

To get details for a specific sales ledger account

http://localhost:88/get/customers?index=BAT001

To get all purchase ledger accounts beginning with ‘S’

http://localhost:88/get/suppliers?index=S

To get details for a specific purchase ledger account

http://localhost:88/get/products?index=SSS0001

To get sales orders grouped by account code

http://localhost:88/get/salesorders?index

To get sales orders for a specific sales ledger account

http://localhost:88/get/salesorders?index=BAT001

To get purchase orders grouped by account code

http://localhost:88/get/purchaseorders?index

To get purchase orders for a specific purchase ledger account

http://localhost:88/get/purchaseorders?index=SSS0001

Accessing the server remotely

This is where the work begins! Unfortunately due to the myriad of routers, VPNs, firewalls and network configurations the ability to access the server remotely is outside the scope of this document. Typically you will use port-forwarding and NAT to enable an outside connection to reach the IP address of the machine on which SRVS is running.