Closed MrRelliks closed 1 year ago
When attempting to send a POST request I get the response of
{ "status": "error", "message": "This method has not been implemented yet." }
I'm having the exact same issue with the banlist API, not sure whats causing it but its totally screwed up my project.
I'm having the exact same issue with the banlist API, not sure whats causing it but its totally screwed up my project.
Well, thankfully I have managed to figure it out. Turns out the Whitelist and Banlist are not controlled via the names "Banlist" and "Whitelist" they are in fact "game settings"
If you like, I can share the code snippet I use to ban people. I'm not at the computer right now, but add me on discord MrRelliks#8248
I'm having the exact same issue with the banlist API, not sure whats causing it but its totally screwed up my project.
`@bot.slash_command(name="banplayer",description="Insert the name of the player you wish to ban (this will restart the server)") @commands.has_role('DayZ Gods') async def banplayer(ctx,playername: str):
url = "https://api.nitrado.net/services/YOURGAMEIDHERE/gameservers/settings" #It needs to be /gameservers/settings
headers = {"Authorization": "Bearer YOURBEARERTOKENHERE"}
await AddToBanList(playername)
await asyncio.sleep(5)
with open('bans.txt', 'r') as file:
datatoupload = file.read()
data = {"category": "general","key":"bans","value":datatoupload} #bans is the key here, for whitelist its just "whitelist"
print(datatoupload)
print(requests.post(url,data=data,headers=headers).json())
await ctx.send(f"ALERT: Ban in progress: {playername} - Server restart incoming.")
await RestartServer(f"Banning {playername}")`
This is my code for Python, its not "https://api.nitrado.net/services/YOURGAMEIDHERE/gameservers/banlist its a gameserver setting (at least in the case of DayZ)
The .txt file is because everytime you update it, it replaces your list with whatever you input, so the .txt is just to keep a track of previous bans and add to that list, rather than replace it.
I have created a longlife token but seemingly don't have sufficient permissions to perform POST requests.
What I am essentially building is a Discord Bot that checks for players killing other players on DayZ (I run a PVE only server, so its vital I get this information) ... Whilst Im able to grab the fact someone was killed via the logs, I am unable to perform a POST request to ad a player to the ban list.
What Im wondering is, do I need to request additional permissions? if so how? Nitrado Customer Support said they won't deal with the API side of things, so im at a loss as to who I can ask.