{"id":187,"date":"2020-04-27T12:06:24","date_gmt":"2020-04-27T12:06:24","guid":{"rendered":"http:\/\/localhost\/senitron\/?page_id=187"},"modified":"2020-04-29T16:45:43","modified_gmt":"2020-04-29T16:45:43","slug":"restapi-login","status":"publish","type":"page","link":"https:\/\/senitron.net\/developers\/restapi-login\/","title":{"rendered":"RESTAPI-Login"},"content":{"rendered":"<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last\" style=\"--awb-bg-size:cover;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-column-wrapper-legacy\"><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-separator fusion-full-width-sep\" style=\"margin-left: auto;margin-right: auto;margin-top:0px;margin-bottom:0px;width:100%;\"><div class=\"fusion-separator-border sep-single sep-solid\" style=\"--awb-height:20px;--awb-amount:20px;border-color:#e2e2e2;border-top-width:2px;\"><\/div><\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-text fusion-text-1\"><p><span class=\"redtextcolor\">Service Name <\/span><span class=\"textindentlevel1\"> \u00a0 \u00a0 \u00a0Login<\/span><br \/>\n<span class=\"redtextcolor\">Service Method <\/span><span class=\"textindentlevel1\"> \u00a0 POST<\/span><br \/>\n<span class=\"redtextcolor\">Service URL <\/span><span class=\"textindentlevel1\"> \u00a0 \u00a0\u00a0 \u00a0 \u00a0\u00a0\/handhelds\/login<\/span><\/p>\n<p><span class=\"redtextcolor\">Request Header Fields <\/span><br \/>\n<span class=\"greentextcolor\">Content-Type<\/span> = <span class=\"cyantextcolor\">application\/json<\/span><br \/>\n<span class=\"greentextcolor\">Api-Key<\/span> = &lt;<span class=\"cyantextcolor\">api key received in register device service<\/span>&gt;<\/p>\n<p><span class=\"darkbluetextcolor\">Request Body Data (JSON)<\/span><br \/>\n{<br \/>\n<span class=\"textindentlevel1\">\"<span class=\"greentextcolor\">email<\/span>\": \"&lt;<span class=\"cyantextcolor\">user email address as username<\/span>&gt;\",<br \/>\n\"<span class=\"greentextcolor\">password<\/span>\": \"&lt;<span class=\"cyantextcolor\">user password<\/span>&gt;\",<br \/>\n\"<span class=\"greentextcolor\">mac_address<\/span>\": \"&lt;<span class=\"cyantextcolor\">device mac address<\/span>&gt;\",<br \/>\n\"<span class=\"greentextcolor\">timeout<\/span>\":&lt;<span class=\"cyantextcolor\">timeout value in minutes<\/span>&gt;<br \/>\n<\/span><br \/>\n}<\/p>\n<p>Note:<br \/>\nDefault values for timeout (session expiration time) is 5 minutes. 0 value for this field means unlimited timeout.<\/p>\n<p><span class=\"darkbluetextcolor\">Response Data (JSON) <\/span><br \/>\n{<br \/>\n<span class=\"textindentlevel1\">\"<span class=\"greentextcolor\">name<\/span>\": \"&lt;<span class=\"cyantextcolor\">name of logged-in user<\/span>&gt;\",<br \/>\n\"<span class=\"greentextcolor\">token<\/span>\": \"&lt;<span class=\"cyantextcolor\">unique token<\/span>&gt;\",<br \/>\n\"<span class=\"greentextcolor\">permissions<\/span>\": {<\/span><br \/>\n<span class=\"textindentlevel2\">\"<span class=\"greentextcolor\">inventory<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">geiger<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">find<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">rfid_lookup<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">transfer<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">change_status<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">search_catalog<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">encode<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">scan_and_print<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">scan_to_device<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">pick_list<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">pallet_build<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">audit_shipment<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;,<br \/>\n\"<span class=\"greentextcolor\">upload<\/span>\": &lt;<span class=\"cyantextcolor\">module access status<\/span>&gt;<\/span><br \/>\n<span class=\"textindentlevel1\">}<\/span><br \/>\n}<\/p>\n<p>Important Note:<br \/>\nYou should store this received <b>token<\/b> in a variable and use it in request header of all other services later.<\/p>\n<p>&nbsp;<\/p>\n<p><span class=\"graytextcolor\">Example<\/span><br \/>\n<span class=\"blacktextcolor\">POST: http:\/\/app.senitron.net\/api\/v1\/handhelds\/login<\/span><br \/>\n{<br \/>\n<span class=\"textindentlevel1\">\"<span class=\"greentextcolor\">email<\/span>\": \"<span class=\"cyantextcolor\">test@test.com<\/span>\",<br \/>\n\"<span class=\"greentextcolor\">password<\/span>\": \"<span class=\"cyantextcolor\">123456<\/span>\",<br \/>\n\"<span class=\"greentextcolor\">mac_address<\/span>\": \"<span class=\"cyantextcolor\">6C:EC:A1:FF:0B:8E<\/span>\",<br \/>\n\"<span class=\"greentextcolor\">timeout<\/span>\": <span class=\"cyantextcolor\">5<\/span><\/span><br \/>\n}<\/p>\n<p><span class=\"darkbluetextcolor\">Response Data (JSON) <\/span><br \/>\n{<br \/>\n<span class=\"textindentlevel1\">\"<span class=\"greentextcolor\">name<\/span>\": \"&lt;<span class=\"cyantextcolor\">name-of-logged-in-user <\/span>&gt;\",<br \/>\n\"<span class=\"greentextcolor\">token<\/span>\": \"<span class=\"cyantextcolor\">xzyqqGciYTJIUzI1NiJ9.eyJ1c2VyX2lkIjozUMMsImNsaWVudF9pZCI6Njks38Dgv8RoZWxkX2lkIjo1MX0.2UqKFrUY1Xy001vyiJiYp5vi09CXzjovf18900AvaT0<\/span>\",<br \/>\n\"<span class=\"greentextcolor\">permissions<\/span>\":{<\/span><br \/>\n<span class=\"textindentlevel2\">\"<span class=\"greentextcolor\">inventory<\/span>\": <span class=\"cyantextcolor\">true<\/span>,<br \/>\n\"<span class=\"greentextcolor\">geiger<\/span>\": <span class=\"cyantextcolor\">true<\/span>,<br \/>\n\"<span class=\"greentextcolor\">find<\/span>\": <span class=\"cyantextcolor\">true<\/span>,<br \/>\n\"<span class=\"greentextcolor\">rfid_lookup<\/span>\": <span class=\"cyantextcolor\">true<\/span>,<br \/>\n\"<span class=\"greentextcolor\">transfer<\/span>\": <span class=\"cyantextcolor\">false<\/span>,<br \/>\n\"<span class=\"greentextcolor\">change_status<\/span>\": <span class=\"cyantextcolor\">true<\/span>,<br \/>\n\"<span class=\"greentextcolor\">search_catalog<\/span>\": <span class=\"cyantextcolor\">true<\/span>,<br \/>\n\"<span class=\"greentextcolor\">encode<\/span>\": <span class=\"cyantextcolor\">false<\/span>,<br \/>\n\"<span class=\"greentextcolor\">scan_and_print<\/span>\": <span class=\"cyantextcolor\">false<\/span>,<br \/>\n\"<span class=\"greentextcolor\">scan_to_device<\/span>\": <span class=\"cyantextcolor\">false<\/span>,<br \/>\n\"<span class=\"greentextcolor\">pick_list<\/span>\": <span class=\"cyantextcolor\">false<\/span>,<br \/>\n\"<span class=\"greentextcolor\">pallet_build<\/span>\": <span class=\"cyantextcolor\">false<\/span>,<br \/>\n\"<span class=\"greentextcolor\">audit_shipment<\/span>\": <span class=\"cyantextcolor\">true<\/span>,<br \/>\n\"<span class=\"greentextcolor\">upload<\/span>\": <span class=\"cyantextcolor\">false <\/span><\/span><br \/>\n<span class=\"textindentlevel1\">}<\/span><br \/>\n}<\/p>\n<\/div><div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"side-navigation.php","meta":{"footnotes":""},"class_list":["post-187","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/senitron.net\/developers\/wp-json\/wp\/v2\/pages\/187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/senitron.net\/developers\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/senitron.net\/developers\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/senitron.net\/developers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/senitron.net\/developers\/wp-json\/wp\/v2\/comments?post=187"}],"version-history":[{"count":0,"href":"https:\/\/senitron.net\/developers\/wp-json\/wp\/v2\/pages\/187\/revisions"}],"wp:attachment":[{"href":"https:\/\/senitron.net\/developers\/wp-json\/wp\/v2\/media?parent=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}