| Both sides previous revision Previous revision Next revision | Previous revision |
| web_interface:rest_api [2025/01/21 16:05] – [Examples] Adrian Boone | web_interface:rest_api [2025/11/04 15:43] (current) – [API definition] Gary Willetts |
|---|
| * Mark a customer invoice as acknowledged (shipped) | * Mark a customer invoice as acknowledged (shipped) |
| * Mark a customer invoice as received (arrived) | * Mark a customer invoice as received (arrived) |
| | * Retrieve stock information |
| |
| Response requisitions will be processed in mSupply as normal in the supplying store, and can be fulfilled by generating and processing one or more customer invoices, depending on stock availability. | Response requisitions will be processed in mSupply as normal in the supplying store, and can be fulfilled by generating and processing one or more customer invoices, depending on stock availability. |
| |
| ===== 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. |
| |
| </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 ===== |
| |
| |
| ^ 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 (which expires in 2 hours) 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. | |
| | /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 ===== |