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 [2025/05/14 03:26] – [What is it?] Gary Willettsweb_interface:rest_api [2025/09/10 11:28] (current) – [API definition] Gary Willetts
Line 21: Line 21:
  
 ===== Authentication ===== ===== Authentication =====
 +=== For all endpoints except /storeCustomerInvoice ===
 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.
  
Line 28: Line 28:
 </WRAP> </WRAP>
  
 +=== For the /storeCustomerInvoice endpoint ===
 +Logins are setup as normal mSupply users. A search for matching customer invoices will be made in the user's default store. 
 ===== API definition ===== ===== API definition =====
  
Line 35: Line 37:
  
 ^ 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 (send it in an Authorization header with scheme Bearer i.e. ''Authorization: Bearer <jwt_token>''). Include the ''loginType = "invoice"'' element in the request body or, for the /storeCustomerInvoice endpoint, include the ''loginType = "storeInvoice"'' element. |+| /login | POST | Login with username and password setup in mSupply. For the ''/storeCustomerInvoice'' endpoint, the username and password must be for an mSupply user. For all other endpoints the username and password must be for a contact of a store name.\\ \\ 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 or, for the ''/storeCustomerInvoice'' endpoint, include the ''loginType = "storeInvoice"'' element. |
 | /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 44: Line 46:
 | /customerInvoiceReceived/{invoice number} | PATCH | Set the specified customer invoice's received (arrival) date to the date specified (in ISO format). | | /customerInvoiceReceived/{invoice number} | PATCH | Set the specified customer invoice's received (arrival) date to the date specified (in ISO format). |
 | /customerInvoiceAcknowledged/{invoice number} | PATCH | Set the specified customer invoice's acknowledged (shipped) date to the date specified (in ISO format). | | /customerInvoiceAcknowledged/{invoice number} | PATCH | Set the specified customer invoice's acknowledged (shipped) date to the date specified (in ISO format). |
-| /storeCustomerInvoice?startDate=YYYY-MM-DD&endDate=YYYY-MM-DD | GET | Return all confirmed (and not cancelled) customer invoices in the default store of the user logged in with, which were confirmed between the startDate and endDate. |+| /storeCustomerInvoice?startDate=YYYY-MM-DD&endDate=YYYY-MM-DD | GET | **Note: This endpoint has a different authentication method to the others. You must login as an mSupply user (see the [[web_interface:rest_api#authentication|Authentication]] section above), not a contact of a store and you must use a different **''loginType''** value.**\\ Returns all confirmed (and not cancelled) customer invoices in the default store of the user logged in with, which were confirmed between the startDate and endDate. |
  
 ===== Examples ===== ===== Examples =====
  • Last modified: 2025/05/14 03:26
  • by Gary Willetts