Getting started
Connect your SARU TECH app to other software
The SARU TECH API gives another application a way to ask for records in your SARU TECH app and send changes back. For example, a pharmacy can share a customer record with an electronic medical record system, or keep product information up to date in another tool.
You choose which product and database to connect. The API uses the same kinds of records you already see in the app, such as customers, products, services, and sales.
Getting started
What is my database?
Your database is the collection of records that belongs to your organisation. Each SARU TECH customer has a separate database. Its full name joins the product and your database name with a dollar sign, such as pharmacy$healthplus. When you connect, enter pharmacy as the product and healthplus as the database name.
A type of record is called an entity. A pharmacy database might have customer, product, drug, and service entities. Your database tells the API which entities exist and which fields each one uses. That is why the lists below can match your own app setup.
pharmacy$healthplus → entity customer → one customer record with its name, phone number, and other fields.Getting started
How do I get my data?
- Select your product. Choose the SARU TECH app whose data you want to use.
- Enter your database name and password. The database name is the part after the dollar sign. Your password stays in this page only while it is open.
- Load the database. We will show the entities and fields available in it.
- Try a read request. In the API Explorer, open “List records,” choose Try it out, enter an entity such as
customer, then select Execute.
To make the same request from your own application, send these three values as HTTP headers:
curl 'https://sarutech.com/api/apps/v1/entities/customer?limit=10' \
-H 'X-Saru-Product: pharmacy' \
-H 'X-Saru-Database: YOUR_DATABASE_NAME' \
-H 'X-Saru-Database-Password: YOUR_DATABASE_PASSWORD'Your application will receive JSON: a list of records with each record’s ID, revision, and data. Keep the database password on your server, and send requests over HTTPS.
{
"data": [
{ "id": "customer123", "revision": "1-example", "data": { "name": "Jane Doe" } }
],
"next_cursor": null
}Getting started
What can I do with the API?
A revision is a version number for a record. It helps the API detect when another person or application changed that record before you saved your update. The API checks fields against your database settings before saving. User accounts cannot be accessed through this API.
Getting started
Practice with a test database
Each product has a test database. For example, pharmacy uses pharmacy$pharmacytest and hospital uses hospital$hospitaltest. Select a product in the API Explorer to see its test database’s entities and field definitions before entering a password.
To run a request against the test database, enter its database name and password in the API Explorer. If you create, update, or delete a record there, the test data changes for other people using that database too. Use a new test record ID when practising writes.
Help
Common questions
Why did I get “invalid credentials”?
Check the product, the database name after the dollar sign, and the database password. For pharmacy$healthplus, enter pharmacy and healthplus separately.
Why was my update rejected?
Another change may have created a new revision. Read the record again, compare the changes, and send the new revision with your update.
Why did I get “too many requests”?
The API slows repeated requests to protect everyone’s database. Wait for the number of seconds in the Retry-After response header before trying again. Repeated invalid passwords can temporarily block your IP address.
Can I use an offline database?
The API can reach a hosted database. If your app stores data only on a local device, synchronise it to a reachable database first.
Will this automatically connect to an EMR?
The API provides the records and operations. Your connecting application still needs to match SARU TECH fields and IDs to the EMR’s format and decide when to sync.
