#Logging into pebblehost via API

20 messages · Page 1 of 1 (latest)

sage lion
#

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.

blazing minnow
sage lion
#

Yes I know

blazing minnow
#

Where did you take your key from?

sage lion
#

I took it out because I don’t want people to have it 😄

blazing minnow
#

I get that

sage lion
#

I got it from the pebblehost server panel - click pebblehost icon in top right > on user page generate API key

#

the key it generated does not match the format of the key given in the example in the docs though

#

Here’s the example key: "_MulticraftAPIKey": "f6952d6eef555ddd87aca66e56b91530222d6e318414816f3ba7cf5bf694bf0f"

Mine looks something like this: “AhF5HfT2#G1”

blazing minnow
#

can you try console.logging it to check if its correct?

sage lion
#

my user is "123@*gmail.*com"
my api key is just the api key from pebblehost

grand sundialBOT
#

@sage lion, you just advanced to level 1 !

blazing minnow
sage lion
#

i already did, they say they dont provide support

#

:/

blazing minnow
#

Well then F

#

Try creating a new token?

blazing minnow