Local API - Hello World (Read Only)
Work in progress
An Easy Start?
The simplest way to get simple (or complex) data from SIMS is to use the reporting engine within the product. This is designed for end users in schools and should enable an average school user to produce a list of pupils without the need to understand relational databases. The idea is that technical integrators (TIs) have a copy of SIMS. The TI creates one or more reports which contain the data they need. They can then export and ship the report definitions with their application and can then extract data in a known format to meet their needs. Importantly, this appears to be part of the TIs application without the need to dig deeper into the architecture of the SIMS applications.
Pre-Requisites
In order to access data via the web, the following pre-requisites are required.
- A Windows PC (Server / PC / Laptop - Latest or Previous version of Windows)
- A copy of SIMS 7 (Installed) (Costs apply)
- A copy of SIMS Training Data (Installed) (Costs apply)
- A copy of Visual Studio (Latest / Previous Version) (Microsoft fees may apply)
- The creation of a suitable user account in SIMS
- A report definition file (Demo.RptDef is provided in the sample code)
There is no 'Free' Option and access to ESS IP is subject to contract.
Download a Sample Application
This is by far the easiest route in to SIMS Integration. Our 'Hello World' application will extract some attendance marks from SIMS.
Download
NB: The sample contains a report definition 'Demo.RptDef' file which contains a sample report Demo01234567.
Visual Studio
Open the .sln file in Visual Studio
Open Program.cs in the Project SIMSReporting
// Sample code is copyright (c) Education Software Solutions Ltd 2021
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SIMSReporting
{
class Program
{
private static string[] Args;
private static string Server { get { return Args[0]; } }
private static string Database { get { return Args[1]; } }
private static string Password { get { return Args[3]; } }
private static string User { get { return Args[2]; } }
private static string FileName { get { return Args[4]; } }
private static string ReportName { get { return Args[5]; } }
static void Main(string[] args)
{
Args = args;
if (args.Length < 5)
{
Console.WriteLine("Report Automation Example (c) Education Software Solutions 2021");
Console.WriteLine("");
Console.WriteLine("Parameters");
Console.WriteLine(" Server Name");
Console.WriteLine(" Database Name");
Console.WriteLine(" SIMS User Name");
Console.WriteLine(" SIMS Password or <Ignore> if current Windows (tm) user");
Console.WriteLine(" Filename of the report definition file containing the report");
Console.WriteLine(" Report Name to run");
Console.WriteLine("");
Console.WriteLine("Utilisation");
Console.WriteLine(" By utilising this code sample or similar to automate the extraction of data from SIMS,");
Console.WriteLine(" Technical Integrators (TI) will be liable to per-site charges as per www.capita-sims.co.uk");
Console.WriteLine(" (follow to become a TI and the guidance available)");
Console.WriteLine("");
Console.WriteLine(@" Outputs to c:\temp\<report name>.xml");
Console.WriteLine("");
Console.ReadKey();
return;
}
string OutputFolder = @"c:\temp";
if (SIMSReportingEngine.ReportingEngine.Load(FileName, Server, Database, User, Password))
{
System.Xml.XmlDocument d = SIMSReportingEngine.ReportingEngine.Run(ReportName, Server, Database, User, Password);
if (!System.IO.Directory.Exists(OutputFolder))
{
System.IO.Directory.CreateDirectory(OutputFolder);
}
d.Save(System.IO.Path.Combine(OutputFolder, ReportName + ".xml"));
}
else
{
Console.WriteLine(SIMSReportingEngine.ReportingEngine.ErrorMessage);
Console.ReadKey();
}
}
}
}
The application should simply build and run. However when run via the debugger, you will need to set the parameters.
Right Click on SIMSReporting and choose properties
Check the command line arguments match :
- 'SIMS Server Instance Name',
- 'SIMS Database Name',
- 'SIMS User Name', //(using the user and password created in the pre-requisites above)
- 'SIMS Password',
- 'in double quotes the path of your report definition file' e.g. "c:\temp\Demo.rptdef"
- The name of the report you want to run in double quotes e.g. "Demo01234567"
It will create a file c:\temp\Demo01234567.xml if successful.
The application includes a helperr library which reduces the active code lines to
SIMSReportingEngine.ReportingEngine.Load(FileName, Server, Database, User, Password);
XmlDocument d = SIMSReportingEngine.ReportingEngine.Run(ReportName, Server, Database, User, Password);
Conclusion
The main barrier to using this method is the installation of a copy of SIMS.
It isn't simple to achieve the 'Hello World' winning event! Given the amount of effort required, it can at times seem quite underwhelming. However the application simply:
- Loads
- Makes API calls
- Some API calls return XML
- Others return complex objects.
However, once you've got an application that reads attendance, for example, typically one to read students or staff simply applies a 'Like This' - ' 'Do That' model. Whilst write-back is often more complex, it is possible to read and write most data items in SIMS using either APIs intended for TI user or the ones used by the application itself.