Get Worker Details
Returns the details of all workers in a subaccount
- CURL
- Javascript
- Python
- Graphql
curl --location --request POST 'https://api.beta.luxor.tech/graphql' \
--header 'Content-Type: application/json' \
--header 'x-lux-api-key: YOUR_API_KEY' \
--data-raw '{"query":"query getWorkerDetails {\n getWorkerDetails(duration: { days: 10 }, mpn: ARRR, uname: \"\", first: 10) {\n edges {\n node {\n minerId\n workerName\n miningProfileName\n updatedAt\n status\n hashrate\n validShares\n staleShares\n invalidShares\n lowDiffShares\n badShares\n duplicateShares\n revenue\n efficiency\n }\n }\n }\n}"}'
const fetch = require('isomorphic-fetch');
const workerDetails = async () => {
const result = await fetch('https://api.beta.luxor.tech/graphql', {
method: 'POST',
headers: {
'x-lux-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: `
query getWorkerDetails($duration: IntervalInput!, $mpn: MiningProfileName!, $uname: String!, $first: Int) {
getWorkerDetails(
duration: $duration
mpn: $mpn
uname: $uname
first: $first
) {
edges {
node {
minerId
workerName
miningProfileName
updatedAt
status
hashrate
validShares
staleShares
invalidShares
lowDiffShares
badShares
duplicateShares
revenue
efficiency
}
}
}
}
`,
variables: {
duration: { minutes: 30 },
mpn: '',
uname: '',
first: 10,
},
}),
});
const res = await result.json();
console.log(JSON.stringify(res, null, 4));
};
workerDetails();
import json
import requests
# Read Luxor host url and API KEY
host = 'https://api.beta.luxor.tech/graphql'
api_key = 'YOUR_API_KEY'
# Attaches auth headers and returns results of a POST request
def luxor_request(host, api_key, query, params):
headers = {
"Content-Type": "application/json",
"x-lux-api-key": f"{api_key}",
}
response = requests.post(host, headers=headers, data=json.dumps({"query": query, "variables": params}).encode("utf-8"))
if response.status_code == 200:
return response.json()
elif response.content:
raise Exception(
str(response.status_code)
+ ": "
+ str(response.reason)
+ ": "
+ str(response.content.decode()),
)
else:
raise Exception(str(response.status_code) + ": " + str(response.reason))
# Construct the request and print the result
query = """query getWorkerDetails($duration: IntervalInput!, $mpn: MiningProfileName!, $uname: String!, $first: Int) {
getWorkerDetails(
duration: $duration
mpn: $mpn
uname: $uname
first: $first
) {
edges {
node {
minerId
workerName
miningProfileName
updatedAt
status
hashrate
validShares
staleShares
invalidShares
lowDiffShares
badShares
duplicateShares
revenue
efficiency
}
}
}
}"""
params = {
'duration': {'minutes':30},
'mpn': "",
'uname': "",
'first': 10
}
resp = luxor_request(host, api_key, query, params)
print(resp)
getWorkerDetails(
mpn: MiningProfileName!
duration: IntervalInput!
uname: String!
first: Int = 0
last: Int = 0
offset: Int = 0
before: Cursor
after: Cursor
): MinerDetailMaterializedsConnection
Example
query getWorkerDetails {
getWorkerDetails(duration: { days: 10 }, mpn: ARRR, uname: "", first: 10) {
edges {
node {
minerId
workerName
miningProfileName
updatedAt
status
hashrate
validShares
staleShares
invalidShares
lowDiffShares
badShares
duplicateShares
revenue
efficiency
}
}
}
}
Response
{
"data": {
"getWorkerDetails": {
"edges": [
{
"node": {
"minerId": "",
"workerName": "",
"miningProfileName": "",
"updatedAt": "",
"status": "",
"hashrate": "",
"validShares": "",
"staleShares": "",
"invalidShares": "",
"lowDiffShares": "",
"badShares": "",
"duplicateShares": "",
"revenue": "",
"efficiency": ""
}
}
]
}
}
}
Arguments
mpn
(MiningProfileName!
)
duration
(IntervalInput!
)
uname
(String!
)
first
(Int
)
Only read the first n
values of the set.
last
(Int
)
Only read the last n
values of the set.
offset
(Int
)
Skip the first n
values from our after
cursor, an alternative to cursor
based pagination. May not be used with last
.
before
(Cursor
)
Read all values in the set before (above) this cursor.
after
(Cursor
)
Read all values in the set after (below) this cursor.
Type
MinerDetailMaterializedsConnection
A connection to a list of MinerDetailMaterialized
values.