Bitcoin Forum
January 16, 2018, 08:24:57 PM *
News: Electrum users must upgrade to 3.0.5 if they haven't already. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How do you query the bmminer API for any information?  (Read 34 times)
fanatic26
Hero Member
*****
Offline Offline

Activity: 588


View Profile
January 12, 2018, 06:36:34 PM
 #1

I just want to pass simple text requests via curl to view bmminer API calls.

I cant find any documentation for it, nor can i find a single example of how to text query cgminerr itself which is what bmminer is a bastardization of.

C:\Windows\system32>curl 10.10.12.20:4028
STATUS=E,When=1515781275,Code=14,Msg=Invalid command,Description=bmminer 1.0.0|

This is all the output I can ever get from bmminer

Stop buying industrial miners, running them at home, and then complaining about the noise.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
nwoolls
Hero Member
*****
Offline Offline

Activity: 826


View Profile WWW
January 12, 2018, 09:29:59 PM
 #2

I just want to pass simple text requests via curl to view bmminer API calls.

I cant find any documentation for it, nor can i find a single example of how to text query cgminerr itself which is what bmminer is a bastardization of.

Try the CGMiner API docs.

MultiMiner: Any Miner, Any Where, on Any Device |  Xgminer: Mine with popular miners on Mac OS X
btc: 1BmXY4ZZQh1iHSVre658gM1gPAEtDnq8rv  |  ltc: LP1SsHZTDexndkvRKsqAkXNsienPHwaMb5  |  hardware: nwoolls at gmail dot com
fanatic26
Hero Member
*****
Offline Offline

Activity: 588


View Profile
January 12, 2018, 11:37:35 PM
 #3


I went through multiple versions of that doc and there is not a single syntax example anywhere. It shows how to do it via json but nothing at all about the syntax for text queries.

Stop buying industrial miners, running them at home, and then complaining about the noise.
nwoolls
Hero Member
*****
Offline Offline

Activity: 826


View Profile WWW
January 13, 2018, 08:40:29 PM
 #4


I went through multiple versions of that doc and there is not a single syntax example anywhere. It shows how to do it via json but nothing at all about the syntax for text queries.

The same repo has several examples in multiple languages:

Quote
api-example.php - a php script to access the API
  usAge: php api-example.php command
 by default it sends a 'summary' request to the miner at 127.0.0.1:4028
 If you specify a command it will send that request instead
 You must modify the line "$socket = getsock('127.0.0.1', 4028);" at the
 beginning of "function request($cmd)" to change where it looks for cgminer

api-example.rb - a Ruby script to access the API.
 usage: ruby api-example.rb command[:parameter] [HOST [PORT]]
This script prints the parsed cgminer API response

API.java/API.class
 a java program to access the API (with source code)
  usAge is: java API command address port
 Any missing or blank parameters are replaced as if you entered:
  java API summary 127.0.0.1 4028

api-example.c - a 'C' program to access the API (with source code)
  usAge: api-example [command [ip/host [port]]]
 again, as above, missing or blank parameters are replaced as if you entered:
  api-example summary 127.0.0.1 4028

miner.php - an example web page to access the API
 This includes buttons and inputs to attempt access to the privileged commands
 See the end of this API-README for details of how to tune the display
and also to use the option to display a multi-rig summary


The long-and-short of it is that you will not be able to do this with cURL - CGMiner is not a REST / HTTP server. It has a TCP/IP API that accepts text and returns text (or JSON depending on how you structure your request). You need to make a TCP/IP connection and then send the correct request to get the expected response.

Edit: here's how you can do it with Netcat instead of cURL (update the IP, port, and "devs" request):

Code:
echo -n "devs" | nc 192.168.0.XYZ 4028

MultiMiner: Any Miner, Any Where, on Any Device |  Xgminer: Mine with popular miners on Mac OS X
btc: 1BmXY4ZZQh1iHSVre658gM1gPAEtDnq8rv  |  ltc: LP1SsHZTDexndkvRKsqAkXNsienPHwaMb5  |  hardware: nwoolls at gmail dot com
fanatic26
Hero Member
*****
Offline Offline

Activity: 588


View Profile
January 15, 2018, 04:33:12 PM
 #5


Edit: here's how you can do it with Netcat instead of cURL (update the IP, port, and "devs" request):

Code:
echo -n "devs" | nc 192.168.0.XYZ 4028


C:\Windows\system32>echo -n 'version' | nc 10.10.12.20 4028
STATUS=E,When=1516033769,Code=14,Msg=Invalid command,Description=bmminer 1.0.0|

C:\Windows\system32>echo -n 'version' |nc 10.10.52.31 4028
STATUS=E,When=1494183042,Code=14,Msg=Invalid command,Description=cgminer 4.10.0|



Am I missing something? It returns the same error message as cURL does. It errors on both bmminer and cgminer.

Stop buying industrial miners, running them at home, and then complaining about the noise.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!