Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
web_interface:sync_api [2020/04/24 13:37] – lou | web_interface:sync_api [2025/01/21 23:18] (current) – [Basics] Mark Glover | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{indexmenu_n> | {{indexmenu_n> | ||
- | ====== | + | ====== |
===== What is it? ===== | ===== What is it? ===== | ||
There are multiple ways to configure an mSupply installation. Where the internet is good, or you are using a local area network, you can have real-time communication with an mSupply server. Where internet access is poor or non-existent, | There are multiple ways to configure an mSupply installation. Where the internet is good, or you are using a local area network, you can have real-time communication with an mSupply server. Where internet access is poor or non-existent, | ||
- | The machine on which the data is stored, which we call a // | + | The machine on which the data is stored, which we call a // |
===== Basics ===== | ===== Basics ===== | ||
You might want to read about our [[web_interface: | You might want to read about our [[web_interface: | ||
- | - The SYNC API is a subset of the mSupply REST API. | + | - The SYNC API is a subset of the [[web_interface: |
- All calls to the sync API use a pseudo-resource of " | - All calls to the sync API use a pseudo-resource of " | ||
- The second URI segment is the API version. Allowable values: | - The second URI segment is the API version. Allowable values: | ||
Line 100: | Line 100: | ||
< | < | ||
- | will retrieve the site ID (integer) and the corresponding store ID (UUID) and store-name ID (UUID) for the sync satellite site with name=Satellite4 on the primary sync site. | + | will retrieve the site ID (integer) and the corresponding store ID (UUID) and store-name ID (UUID) for the sync satellite site with name=Satellite4 on the primary sync site. Used by mobile during login to lookup the store for the site. |
< | < | ||
- | will retrieve the user ID (UUID) for the sync satellite site having store ID=CVCBNXNSHHSH (UUID, returned by the above REST call) on the primary sync site. | + | will retrieve the user ID (UUID) for the sync satellite site having store ID=CVCBNXNSHHSH (UUID, returned by the above REST call) on the primary sync site. Used by mobile during login to lookup the user for the store. |
=== HTTP POST === | === HTTP POST === | ||
Line 132: | Line 132: | ||
] | ] | ||
</ | </ | ||
+ | |||
+ | |||
+ | ===== Available calls (v4) ===== | ||
+ | |||
+ | |||
+ | === HTTP POST === | ||
+ | < | ||
+ | will tell the server to create a name_store_join record for the store and name records defined in the body. Used to make a patient visible when their first prescription has been processed in a store. | ||
+ | |||
+ | == Body == | ||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | == Response == | ||
+ | If all is well, 200 OK and the payload: | ||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | A 400 will be returned if either of the payload elements are missing or the IDs are not present. | ||
+ | |||
+ | A 401 will be returned if authentication fails. | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | === HTTP GET === | ||
+ | |||
+ | < | ||
+ | Requests patient dispensing history for the specified name record | ||
+ | |||
+ | |||
+ | == Response == | ||
+ | If all is well, 200 OK and the payload: | ||
+ | < | ||
+ | [ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | An empty array will be returned if the ID does not match a name record or there is no history to return. | ||
+ | |||
+ | A 401 will be returned if authentication fails. | ||
+ | |||
+ | |||
+ | ===== Available calls (v5) ===== | ||
+ | ==== HTTP GET ==== | ||
+ | === central_records === | ||
+ | < | ||
+ | Requests sync change log records for the sync site matching the authentication sent in the header. | ||
+ | |||
+ | == Attributes == | ||
+ | * **cursor**: the record number to return from. e.g. '' | ||
+ | * **limit**: the maximum number of records that can be returned. If omitted, the //limit// is set to 1000. If a //limit// value above 1000 is used, the //limit// is set to 1000. | ||
+ | |||
+ | === queue === | ||
+ | < | ||
+ | Requests sync records that require processing for the sync site which matches the authentication passed in the header. | ||
+ | |||
+ | == Attributes == | ||
+ | * **limit**: the maximum number of records that can be returned. If ommitted, the //limit// is set to 1000. If a //limit// value above 1000 is used, the //limit// is set to 1000. | ||
+ | |||
+ | |||
\\ | \\ | ||
\\ | \\ | ||
- | | // Previous: | + | | // Previous: |
---- struct data ---- | ---- struct data ---- | ||
+ | pagestatus.status | ||
---- | ---- | ||