Hey all, i’ve been having trouble trying to log into pebblehost using their gamepanel API and the docs for it can be found here - https://help.pebblehost.com/en/minecraft/using-the-pebblehost-game-panel-api
I’m hoping someone on here knows about the API, because pebblehost does not offer support for it.
Whenever I run my login script as in accordance with the docs instructions, it has trouble recognizing my API key. Here is the script and the error I have been getting:
import requests
import hashlib
#credentials
PEBBLEHOST_API_USER = "user"
PEBBLEHOST_API_KEY = "key"
def make_pebblehost_api_request(method, content=None):
url = "https://panel.pebblehost.com/api.php"
params = {
"_MulticraftAPIUser": PEBBLEHOST_API_USER,
"_MulticraftAPIMethod": method,
"server_id": ID,
"mode": "rw",
}
keystr = ""
for param, value in params.items():
keystr += param + str(value)
hmac = hashlib.sha256(PEBBLEHOST_API_KEY.encode())
hmac.update(keystr.encode())
digest = hmac.hexdigest()
params["_MulticraftAPIKey"] = digest
try:
response = requests.post(url, data=params)
data = response.json()
return data
except requests.exceptions.RequestException as e:
print("API request error:", e)
return None
method = "getServerChat"
response = make_pebblehost_api_request(method)
print(response)
{'success': False, 'errors': ['Incorrect API key from user: user'], 'data': []}
My username, api key and server ID have been removed from the script for safety.
PebbleHost Knowledgebase
This article provides a brief rundown on how to get started with the PebbleHost Game Panel API