From 46f1661fd905e6c8634ef60a7c55a94744fbcef0 Mon Sep 17 00:00:00 2001 From: xmrig Date: Tue, 6 Aug 2019 12:48:00 +0700 Subject: [PATCH] Update API.md --- doc/API.md | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/doc/API.md b/doc/API.md index 3357eabb..2cd0fbbe 100644 --- a/doc/API.md +++ b/doc/API.md @@ -1,26 +1,39 @@ # HTTP API -If you want use API you need choice a port where is internal HTTP server will listen for incoming connections. API will not available if miner built without `libmicrohttpd`. +If you want use HTTP API you need enable it (`"enabled": true,`) then choice `port` and optionaly `host`. API not available if miner built without HTTP support (`-DWITH_HTTP=OFF`). + +Offical HTTP client for API: http://workers.xmrig.info/ Example configuration: ```json "api": { - "port": 44444, - "access-token": "TOKEN", - "worker-id": null, - "ipv6": false, - "restricted": false + "id": null, + "worker-id": null, }, +"http": { + "enabled": false, + "host": "127.0.0.1", + "port": 0, + "access-token": null, + "restricted": true +} ``` -* **port** Port for incoming connections `http://:`. -* **access-token** [Bearer](https://gist.github.com/xmrig/c75fdd1f8e0f3bac05500be2ab718f8e#file-api-html-L54) access token to secure access to API. +#### Global API options +* **id** Miner ID, if not set created automatically. * **worker-id** Optional worker name, if not set will be detected automatically. -* **ipv6** Enable (`true`) or disable (`false`) IPv6 for API. + +#### HTTP API options, +* **enabled** Enable (`true`) or disable (`false`) HTTP API. +* **host** Host for incoming connections `http://:`, to allow connections from all interfaces use `0.0.0.0` (IPv4) or `::` (IPv4+IPv6). +* **port** Port for incoming connections `http://:`, zero port is valid option and means random port. +* **access-token** [Bearer](https://gist.github.com/xmrig/c75fdd1f8e0f3bac05500be2ab718f8e#file-api-html-L54) access token to secure access to API. Miner support this token only via `Authorization` header. * **restricted** Use `false` to allow remote configuration. -If you prefer use command line options instead of config file, you can use options: `--api-port`, `--api-access-token`, `--api-worker-id`, `--api-ipv6` and `api-no-restricted`. +If you prefer use command line options instead of config file, you can use options: `--api-id`, `--api-worker-id`, `--http-enabled`, `--http-host`, `--http-access-token`, `--http-port`, `--http-no-restricted`. + +Versions before 2.15 was use another options for API https://github.com/xmrig/xmrig/issues/1007 ## Endpoints @@ -50,4 +63,4 @@ Curl example: ``` curl -v --data-binary @config.json -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/1/config -``` \ No newline at end of file +```