{"id":1768,"date":"2017-11-18T22:03:04","date_gmt":"2017-11-18T20:03:04","guid":{"rendered":"https:\/\/einstein.amsterdam\/?page_id=1768"},"modified":"2017-11-20T18:23:34","modified_gmt":"2017-11-20T16:23:34","slug":"sharkrf-openspot-api-profiles","status":"publish","type":"page","link":"https:\/\/einstein.amsterdam\/?page_id=1768","title":{"rendered":"SharkRF openSPOT API Profiles"},"content":{"rendered":"<p>Profile switcher menu<\/p>\n<p>To switch between my profiles, i made a script \ud83d\ude42<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1796 size-full\" src=\"https:\/\/einstein.amsterdam\/wp-content\/uploads\/openSPOT-profleswitcher.png\" alt=\"\" width=\"568\" height=\"410\" srcset=\"https:\/\/einstein.amsterdam\/wp-content\/uploads\/openSPOT-profleswitcher.png 568w, https:\/\/einstein.amsterdam\/wp-content\/uploads\/openSPOT-profleswitcher-300x217.png 300w\" sizes=\"(max-width: 568px) 100vw, 568px\" \/><\/p>\n<p>sh script code below:<\/p>\n<p><div class=\"su-divider su-divider-style-default\" style=\"margin:15px 0;border-width:3px;border-color:#999999\"><\/div><br \/>\n<code><br \/>\npassword=\"openspot\"<br \/>\nserver=\"openspot.local\"<br \/>\ntoken=\"Login first (1) !!\"<br \/>\nwhile :<br \/>\ndo<br \/>\nclear<br \/>\necho \"---------------------------\"<br \/>\necho \" openSPOT Profile switcher \"<br \/>\necho \" script made by PD2EMC\"<br \/>\necho \" \"<br \/>\necho \" Server: \"$server<br \/>\necho \" Password:\" $password<br \/>\necho \" Token:\" $token<br \/>\necho \" \"<br \/>\necho \"---------------------------\"<br \/>\necho \"|[1] Login to openSPOT !! |\"<br \/>\necho \"|[2] Check Authorisation |\"<br \/>\necho \"|[3] openSPOT Profiles |\"<br \/>\necho \"|[4] Profile 0 DMR |\"<br \/>\necho \"|[5] Profile 1 YSF |\"<br \/>\necho \"|[6] Profile 2 FCS |\"<br \/>\necho \"|[7] Profile 3 C4FM-&gt;DMR |\"<br \/>\necho \"|[8] Profile 4 DMR-&gt;C4FM |\"<br \/>\necho \"|[9] Reboot openSPOT |\"<br \/>\necho \"|[0] Exit Menu |\"<br \/>\necho \"---------------------------\"<br \/>\necho -n \"Please enter option [1-0] \"<br \/>\nread opt<br \/>\ncase $opt in<br \/>\n1) echo \"Login to sharkRF Openspot\";<br \/>\ntokenurl=`curl http:\/\/$server\/gettok.cgi| sed 's\/{\"token\":\"\/\/'|sed 's\/\"}\/\/'`;<br \/>\ntoken=${tokenurl};<br \/>\ndigest=`echo -n ${tokenurl}${password} | shasum -a 256 | sed 's\/-\/\/'`;<br \/>\njwt=`curl -X POST --header \"Content-Type: application\/json\" --data \"{\\\"token\\\":\\\"$token\\\",\\\"digest\\\":\\\"$digest\\\"}\" \"http:\/\/$server\/login.cgi\" | sed 's\/{\"hostname\":\"openspot\",\"jwt\":\"\/\/'|sed 's\/\"}\/\/'`;;<br \/>\n2) echo \"Checking authorisation\";<br \/>\ncurl -H \"Authorization: Bearer $jwt\" http:\/\/$server\/checkauth.cgi | json_pp;<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\n3) echo \"Getting Profile settings\";<br \/>\ncurl -H \"Authorization: Bearer $jwt\" http:\/\/$server\/cpsettings.cgi | json_pp;<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\n4) echo \"Switching to Profile 0\";<br \/>\ncurl -X POST -H \"Authorization: Bearer $jwt\" --data \"{\\\"active_cp\\\":\\\"0\\\"}\" \"http:\/\/$server\/cpsettings.cgi\";<br \/>\ntoken=\"Login first (1) !!\";<br \/>\ndigest=\"\";<br \/>\njwt=\"\";<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\n5) echo \"Switching to Profile 1\";<br \/>\ncurl -X POST -H \"Authorization: Bearer $jwt\" --data \"{\\\"active_cp\\\":\\\"1\\\"}\" \"http:\/\/$server\/cpsettings.cgi\";<br \/>\ntoken=\"Login first (1) !!\";<br \/>\ndigest=\"\";<br \/>\njwt=\"\";<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\n6) echo \"Switching to Profile 2\";<br \/>\ncurl -X POST -H \"Authorization: Bearer $jwt\" --data \"{\\\"active_cp\\\":\\\"2\\\"}\" \"http:\/\/$server\/cpsettings.cgi\";<br \/>\ntoken=\"Login first (1) !!\";<br \/>\ndigest=\"\";<br \/>\njwt=\"\";<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\n7) echo \"Switching to Profile 3\";<br \/>\ncurl -X POST -H \"Authorization: Bearer $jwt\" --data \"{\\\"active_cp\\\":\\\"3\\\"}\" \"http:\/\/$server\/cpsettings.cgi\";<br \/>\ntoken=\"Login first (1) !!\";<br \/>\ndigest=\"\";<br \/>\njwt=\"\";<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\n8) echo \"Switching to Profile 4\";<br \/>\ncurl -X POST -H \"Authorization: Bearer $jwt\" --data \"{\\\"active_cp\\\":\\\"4\\\"}\" \"http:\/\/$server\/cpsettings.cgi\";<br \/>\ntoken=\"Login first (1) !!\";<br \/>\ndigest=\"\";<br \/>\njwt=\"\";<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\n9) echo \"Rebooting openSPOT\";<br \/>\ncurl -H \"Authorization: Bearer $jwt\" http:\/\/$server\/reboot.cgi | json_pp<br \/>\ntoken=\"Login first (1) !!\";<br \/>\ndigest=\"\";<br \/>\njwt=\"\";;<br \/>\n0) echo \"Bye bye $USER\";<br \/>\nexit 1;;<br \/>\n*) echo \"$opt is an invaild option. Please select option between 1-0 only\";<br \/>\necho \"Press [enter] key to continue. . .\";<br \/>\nread enterKey;;<br \/>\nesac<br \/>\ndone<br \/>\n<\/code><br \/>\n<div class=\"su-divider su-divider-style-default\" style=\"margin:15px 0;border-width:3px;border-color:#999999\"><\/div><\/p>\n<p>Next i build a openSPOT Menu, check it out <a href=\"https:\/\/einstein.amsterdam\/?page_id=1802\">here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Profile switcher menu To switch between my profiles, i made a script \ud83d\ude42 sh script code below: password=&#8221;openspot&#8221; server=&#8221;openspot.local&#8221; token=&#8221;Login first (1) !!&#8221; while : <a class=\"mh-excerpt-more\" href=\"https:\/\/einstein.amsterdam\/?page_id=1768\" title=\"SharkRF openSPOT API Profiles\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=\/wp\/v2\/pages\/1768"}],"collection":[{"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1768"}],"version-history":[{"count":29,"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=\/wp\/v2\/pages\/1768\/revisions"}],"predecessor-version":[{"id":1821,"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=\/wp\/v2\/pages\/1768\/revisions\/1821"}],"wp:attachment":[{"href":"https:\/\/einstein.amsterdam\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}