{"id":12436,"date":"2025-08-14T23:57:34","date_gmt":"2025-08-14T21:57:34","guid":{"rendered":"https:\/\/help.mapal-os.com\/?p=12436"},"modified":"2026-01-27T15:43:29","modified_gmt":"2026-01-27T14:43:29","slug":"soumettre-des-ventes-en-temps-rael-via-api","status":"publish","type":"post","link":"https:\/\/help.mapal-os.com\/fr\/analytics-fr\/ventes\/soumettre-des-ventes-en-temps-rael-via-api\/","title":{"rendered":"Soumettre des ventes en temps r\u00e9el via API"},"content":{"rendered":"\n\n<p><strong>Start from:<\/strong> Your server-to-server integration (API client).<\/p>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Real-time Sales API<\/strong><\/h2>\n\n\n\n\n\n\n<p>The <strong>Real-time Sales API<\/strong> is a RESTful service for <strong>submitting live sales data<\/strong> securely.<\/p>\n\n\n\n\n\n\n<p><strong>Key Benefits:<\/strong><\/p>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Immediate updates to sales figures.<\/li>\n\n\n\n\n\n\n<li>Secure server-to-server connection (HTTPS + JWT).<\/li>\n\n\n\n\n\n\n<li>Supports flexible filtering by business unit and business day.<\/li>\n<\/ul>\n\n\n\n\n\n\n<p><strong style=\"font-size: 30px;\">Generate a JWT token<\/strong><\/p>\n\n\n\n\n\n\n<p><strong>POST to:<\/strong> <a class=\"\" href=\"https:\/\/login.mapal-os.com\/connect\/token\" target=\"_new\" rel=\"noopener\" data-start=\"190\" data-end=\"230\">https:\/\/login.mapal-os.com\/connect\/token<\/a><\/p>\n\n\n\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><p data-start=\"250\" data-end=\"271\">grant_type=password<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"274\" data-end=\"300\">username=<your_username><\/your_username><\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"303\" data-end=\"329\">password=<your_password><\/your_password><\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"332\" data-end=\"353\">client_id=wf_wap_tp<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"356\" data-end=\"431\">client_secret=<shared_client_secret> (contact Customer Support to obtain)<\/shared_client_secret><\/p><\/li>\n<\/ul>\n\n\n\n\n\n\n<p><strong>Successful response includes: <\/strong>access_token, expires_in, token_type, refresh_token, scope.<\/p>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\"><strong data-start=\"531\" data-end=\"564\">Include the token in requests<\/strong><\/h2>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><strong>Add header: <\/strong>Authorization: Bearer {access_token}<\/li>\n<\/ul>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Submit real-time sales<\/h2>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><strong>Base domain:<\/strong> <a class=\"\" data-start=\"666\" data-end=\"706\" href=\"https:\/\/api.workforce.mapal-os.com\/sales\" target=\"_new\" rel=\"noopener\">https:\/\/api.workforce.mapal-os.com\/sales<\/a><\/li>\n\n\n\n\n\n\n<li><strong>Endpoint path:<\/strong> \/api\/v1\/business-unit\/{unitId}\/real-time-sales<\/li>\n\n\n\n\n\n\n<li><strong>Method:<\/strong> GET (if your OpenAPI specification shows a different method, follow the specification)<\/li>\n<\/ul>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Parameters \/ payload fields<\/h2>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><p data-start=\"904\" data-end=\"929\">unitId (route, integer)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"904\" data-end=\"929\">businessDay (string, yyyy-MM-dd)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"969\" data-end=\"1004\">realTimeSales (array of objects):<\/p>\n\n<ul class=\"wp-block-list\">\n\n<li><p data-start=\"1009\" data-end=\"1030\">currencyId (string)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1035\" data-end=\"1057\">salesTypeId (string)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1062\" data-end=\"1097\">timeSlotStart (string, date-time)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1102\" data-end=\"1122\">netSales (decimal)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1127\" data-end=\"1149\">grossSales (decimal)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1154\" data-end=\"1175\">numChecks (integer)<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1180\" data-end=\"1201\">numGuests (integer)<\/p><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Check submitted sales<\/h2>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Navigate to <strong>Analytics &gt; Sales<\/strong> in Mapal OS.<\/li>\n<\/ul>\n\n\n\n\n\n\n<p><strong data-start=\"1287\" data-end=\"1296\">Notes:<\/strong><\/p>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><p data-start=\"1301\" data-end=\"1331\">All requests must use HTTPS.<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1334\" data-end=\"1387\">Tokens expire (expires_in) and must be regenerated.<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1390\" data-end=\"1429\">Tokens can be revoked if compromised.<\/p><\/li>\n<\/ul>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Error handling<\/h2>\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><p data-start=\"1459\" data-end=\"1570\"><strong>400 Bad Request:<\/strong> Invalid unit ID; business day mismatch; currency or sales type mismatch; invalid time slots.<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1573\" data-end=\"1618\"><strong>401 Unauthorized:<\/strong> Invalid or missing token.<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1621\" data-end=\"1679\"><strong>404 Not Found:<\/strong> Tenant or tenant configuration not found.<\/p><\/li>\n\n\n\n\n\n\n<li><p data-start=\"1682\" data-end=\"1710\"><strong>500 Internal Server Error.<\/strong><\/p><\/li>\n<\/ul>\n\n\n\n\n\n\n\n\n\n\n<li><p data-start=\"1682\" data-end=\"1710\"><strong><\/strong><\/p><\/li>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>En tant que d\u00e9veloppeur int\u00e9grant votre syst\u00e8me avec Mapal OS, vous pouvez soumettre des ventes en temps r\u00e9el via API afin que les chiffres soient instantan\u00e9ment disponibles pour les rapports et les pr\u00e9visions. L'API de ventes en temps r\u00e9el est RESTful et s\u00e9curis\u00e9e avec HTTPS et JWT.<\/p>\n","protected":false},"author":251210541,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[132059],"tags":[],"class_list":["post-12436","post","type-post","status-publish","format-standard","hentry","category-ventes"],"acf":{"article_type":"default","post_id":"","post_url_text":"","post_url":"","info_box":{"title":"","info":""},"post_video":"","import_category":"","overview_item":null,"troubleshoot_case":null},"_links":{"self":[{"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/posts\/12436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/users\/251210541"}],"replies":[{"embeddable":true,"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/comments?post=12436"}],"version-history":[{"count":0,"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/posts\/12436\/revisions"}],"wp:attachment":[{"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/media?parent=12436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/categories?post=12436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.mapal-os.com\/fr\/wp-json\/wp\/v2\/tags?post=12436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}