How to Check Account Status / How to ask NIS via API calls

Hi punkrock,


since this information could be interesting to others, I posted it here.


You can find API Docomentation under following links.


NCC = [url=https://github.com/NewEconomyMovement/NemCommunityClient/blob/master/docs/api.md]https://github.com/NewEconomyMovement/NemCommunityClient/blob/master/docs/api.md
NIS = [url=http://bob.nem.ninja/docs/]http://bob.nem.ninja/docs/




To check if a NODE is harvesting for an account you can use NIS API and check if an account is unlocked.
If an account is unlocked the node is able to harvesting with this Account.


A little ruby script to check if an account is harvesting. Is not a good coding style, but its working to show how you can use API.




<br /><br />#!/usr/bin/ruby<br /><br /><br />require &#039;rubygems&#039;<br />require &#039;json&#039;<br />require &#039;pp&#039;<br />require &quot;net/http&quot;<br />require &quot;uri&quot;<br />require &quot;yaml&quot;<br /><br /><br />$host=&quot;http://eu.nemno.de:7890&quot;<br />nem_addr= ARGV[0] || &quot;NA33NPNDHQFP2YFLKQVEK3KC3O3WJIUTTTYX4TU5&quot;<br />params = {&quot;address&quot; =&gt; nem_addr}<br /><br /><br />account_get=&quot;/account/get&quot;<br /><br /><br />def response(call,par)<br />&nbsp; uri= URI.parse($host + call)<br />&nbsp; uri.query = URI.encode_www_form(par)<br />&nbsp; res = Net::HTTP.get_response(uri) <br />&nbsp; JSON.parse(res.body)<br />end<br /><br /><br /><br /><br />acc=response(account_get,params)<br />#pp acc <br />status = acc[&quot;meta&quot;][&quot;status&quot;]<br /><br /><br />if status == &quot;LOCKED&quot; <br />&nbsp; puts &quot;Account @nem_addr is not harvesting&quot;<br />elsif status == &quot;UNLOCKED&quot;<br />&nbsp; puts &quot;Account @nem_addr is harvesting&quot;<br />else<br />&nbsp; puts &quot;Some unexpected happened :-/&quot;<br />end<br /><br /><br />


The nem_addr in this script is from my current Remote Account
I started delegated harvesting on eu.nemno.de manually.


FireF

Thanks for this. Will check it out now.