Referral rewards¶
Returns referrals rewards that have been applied to an account.
Authentication required
Requires account user level access.
-
Arguments
accountNumber
:String!
-
Returns
Examples¶
Get all rewards¶
import pprint
import requests
# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
"Authorization": f"JWT {JWT_TOKEN}"
}
QUERY = """
query getAccountReferralRewards($accountNumber: String!) {
account(accountNumber: $accountNumber) {
referrals{
edges {
node {
id
referredUserName
paymentDate
paymentStatus
referredUserJoinDate
code
referredUserPaymentAmount
referringUserPaymentAmount
combinedPaymentAmount
}
}
}
}
}
"""
VARIABLES = {
"accountNumber":"A-12345"
}
session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
url=API_URL,
json={"query": QUERY, "variables": VARIABLES}
)
pprint.pprint(response.json())
const axios = require("axios")
// const apiUrl = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test
const jwtToken = "PLACE_JWT_TOKEN_HERE"
let headers = {
"Authorization": `JWT ${jwtToken}`
}
const query = `
query getAccountReferralRewards($accountNumber: String!) {
account(accountNumber: $accountNumber) {
referrals{
edges {
node {
id
referredUserName
paymentDate
paymentStatus
referredUserJoinDate
code
referredUserPaymentAmount
referringUserPaymentAmount
combinedPaymentAmount
}
}
}
}
}
`
const variables = {
"accountNumber": "A-12345"
}
axios({
url: apiUrl,
method: "post",
data: {
query: query,
variables: variables,
},
headers: headers,
}).then((response) => {
console.log(JSON.stringify(response.data, null, 4));
});
import axios from 'axios';
// const API_URL = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
export const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test
export const jwtToken = "PLACE_JWT_TOKEN_HERE"
let headers = {"Authorization": `JWT ${jwtToken}`}
export const query = `
query getAccountReferralRewards($accountNumber: String!) {
account(accountNumber: $accountNumber) {
referrals{
edges {
node {
id
referredUserName
paymentDate
paymentStatus
referredUserJoinDate
code
referredUserPaymentAmount
referringUserPaymentAmount
combinedPaymentAmount
}
}
}
}
}
`
export const variables = {
"accountNumber": "A-12345"
}
axios({
url: apiUrl,
method: "post",
data: {
query: query,
variables: variables,
},
headers: headers,
}).then((response) => {
console.log(JSON.stringify(response.data, null, 4));
});
Get the first X number of rewards¶
import pprint
import requests
# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
"Authorization": f"JWT {JWT_TOKEN}"
}
QUERY = """
query getAccountReferralRewards($accountNumber: String!, $first:Int!) {
account(accountNumber: $accountNumber) {
referrals(first:$first){
edges {
node {
id
referredUserName
paymentDate
paymentStatus
referredUserJoinDate
code
referredUserPaymentAmount
referringUserPaymentAmount
combinedPaymentAmount
}
}
}
}
}
"""
VARIABLES = {
"accountNumber":"A-78910",
"first":1
}
session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
url=API_URL,
json={"query": QUERY, "variables": VARIABLES}
)
pprint.pprint(response.json())
const axios = require("axios")
// const apiUrl = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test
const jwtToken = "PLACE_JWT_TOKEN_HERE"
let headers = {
"Authorization": `JWT ${jwtToken}`
}
const query = `
query getAccountReferralRewards($accountNumber: String!, $first:Int!) {
account(accountNumber: $accountNumber) {
referrals(first:$first){
edges {
node {
id
referredUserName
paymentDate
paymentStatus
referredUserJoinDate
code
referredUserPaymentAmount
referringUserPaymentAmount
combinedPaymentAmount
}
}
}
}
}
`
const variables = {
"accountNumber": "A-78910",
"first": 1
}
axios({
url: apiUrl,
method: "post",
data: {
query: query,
variables: variables,
},
headers: headers,
}).then((response) => {
console.log(JSON.stringify(response.data, null, 4));
});