web_interface:rest_api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
web_interface:rest_api [2023/06/26 15:18] Gary Willettsweb_interface:rest_api [2024/02/13 11:40] (current) – [Authentication] Adrian Boone
Line 21: Line 21:
 ===== Authentication ===== ===== Authentication =====
 Logins (user name and password) are set up per store as contacts of store names. This uses exactly the same mechanism as customer web ordering. See the [[web_interface:msupply_customer_setup|]] page for details. Logins (user name and password) are set up per store as contacts of store names. This uses exactly the same mechanism as customer web ordering. See the [[web_interface:msupply_customer_setup|]] page for details.
 +
 +<WRAP info center round 90%>
 +All requests relate to transactions, stock and orders **only** in the store that the user used to authenticate with is a contact of. The customer and supplier's details are derived from the log-in details i.e. the customer will be the store the logged in user is a contact of and the supplier will be the supplying store of that store.
 +</WRAP>
  
  
Line 29: Line 33:
  
 ^ URL ^ HTTP Verb ^Description| ^ URL ^ HTTP Verb ^Description|
-| /login | POST | Login with username and password setup in mSupply. Returns a JWT cookie to be used in following requests. Include the ''loginType = "invoice"'' element in the request body. |+| /login | POST | Login with username and password setup in mSupply. Returns a JWT cookie to be used in following requests (send it in an Authorization header with scheme Bearer i.e. ''Authorization: Bearer <jwt_token>''). Include the ''loginType = "invoice"'' element in the request body. |
 | /stock | GET | Returns an array of stock details for all items in the customer's master list(s). \\ * Quantities are specified in number of packs and pack size. \\ * Separate lines for each different batch, expiry date or pack size. | | /stock | GET | Returns an array of stock details for all items in the customer's master list(s). \\ * Quantities are specified in number of packs and pack size. \\ * Separate lines for each different batch, expiry date or pack size. |
 | /stock?code=xxx&name=yyy | GET | Returns an array of stock details for all visible items, optionally restricted to those starting with the specified code/name. \\ * Quantities are specified in number of packs and pack size. \\ * Separate lines for each different batch, expiry date or pack size. | | /stock?code=xxx&name=yyy | GET | Returns an array of stock details for all visible items, optionally restricted to those starting with the specified code/name. \\ * Quantities are specified in number of packs and pack size. \\ * Separate lines for each different batch, expiry date or pack size. |
Line 57: Line 61:
     "userJobTitle": "Boss",     "userJobTitle": "Boss",
     "userType": "contact",     "userType": "contact",
-    "service": "vesalius",+    "service": "invoice",
     "storeName": "General Warehouse"     "storeName": "General Warehouse"
 } }
Line 244: Line 248:
     "error": "JWT token/user ID/store ID not found"     "error": "JWT token/user ID/store ID not found"
 } }
-</code> Returns all customer invoices for the logged in customer in their supplying store which have been created from response requisitions created by Vesalius (i.e. have "vesalius" somewhere in their comment field) and confirmed, but which haven't yet been received or cancelled. Note that a single customer order can be split into multiple customer invoices |+</code> Returns all customer invoices for the logged in customer in their supplying store and confirmed, but which haven't yet been received or cancelled. Note that a single customer order can be split into multiple customer invoices |
 | api/v4/customerInvoiceReceived/8567546 | PATCH | Request: <code=javascript> | api/v4/customerInvoiceReceived/8567546 | PATCH | Request: <code=javascript>
 { {
  • Last modified: 2023/06/26 15:18
  • by Gary Willetts