Question Regarding GimKit API

have 2 main questions regarding access to the API.

  1. Is it breaking the ToS to use the api (I’ve checked and it is reverse engineerable enough to do basic concepts with it)

  2. If it doesn’t break the ToS, then how are blocks stored using the API? On some cloud? And in that case, wouldn’t the link be based upon the game id and therefore accessible.

I figure I might as well try to make an extension for copying and pasting blocks over so making projects that have very similar blocks aren’t so PAINFUL to make.

There’s also some cool ideas I have regarding using the API (No spoilers :slight_smile:)

EDIT: 3 hours before I can post again due to new user post limit, so sorry if I don’t reply. Can you explain further Blackhole. Isn’t the server storage accessible somehow? And yeah that would be nice about the Python code.

EDIT 2: Sort of? From my understanding you can send a request to the websocket (which should be contained within GimKit inspect somewhere).

EDIT 3: Nah, it’s fine. I might end up messing with it (a more advanced module for this could maybe access the Colyseus websocket directly for requests?). It’s readable, so yeah lol.

EDIT 4: @WolfTechnology, I’ve messed with it for the last 7 years or so (since I was around 9), so I’d recommend finding an interesting project, and using google/documentation for creating the project in python. As you do it more and more you’ll find yourself getting better at it :slight_smile:.

EDIT 5 (phew alot of edits): @Blackhole927 that doesn’t sound quite right. It’s been a little since I messed around to make a Kahoot bot a few years back, but you can edit the inspect through python 100%. There are modules that can emulate the js to access it.

EDIT 6: @Blackhole927, the real reason I’m not using JS though is because I’m not that good with it. I haven’t done much with other languages besides python (never found the need), so while I’d like to think I’m up to a near industry level with python, I can’t really use JS (working on learning it now with C++, C# and some network stuff).

Oh, and python can compile it to JS. There’s some nice modules that can do it for me

EDIT 7: Sorry for being off topic here, but I found the answer to someone’s question and can’t post for the next 2 hours still @acercar2 you can’t turn on damage for the prop if it’s not set to a global scope. Get this to them please. Props damage can be enabled, but a few minutes later it can’t? - Help - Gimkit Creative

2 Likes

You could try to email gimkit at their email and ask if its okay directly, since im not 100% sure about it.

Their email is hello@gimkit.com

Other than that im not 100% sure if its allowed or if its okay since I also didn’t see anything about it in TOS so I dont know. Sorry

I don’t believe it does break the ToS, and based off of my knowledge with blocks(which is ok) the blocks are stored in the maps memory, so like a storage. All the blocks do is specify what that device does. But I would ask @Blackhole927 @Shdwy or @getrithekd That and maybe email gimkit to get full knowledge of that. hello@gimkit.com

1 Like

Using the API is allowed, as long as it doesn’t put extra stress on the gimkit servers.
As for blocks, you can’t access blocks with the API, that’s a modding problem, not an API one.
(If you still want to play with the API, I have some python code I can send you if you want.)

2 Likes

See, I wouldn’t have known that I had to google API, java scrip doesn’t teach you that.

Alright- explaining further:
So the API is for things like fetching and updating user info, selected skins, etc. It’s also used to start games.

However, for modifications to a map, a JS library called Colyseus is used. To modify things in game, you have to send requests over the Colyseus websocket connection. Therefore, to change blocks, you have to send messages over colyseus instead of the API.

If you want to learn more about modding, I recommend you j0in the gimhook discord.

3 Likes

I never knew that, so in gimkit, how would you even send a request to Colyseus? via the inspect of the sites code? Because I haven’t found an area on the blocks section were you can write script.

Annnnd another thing! Here is an excerpt of the python code I wrote for the API.
I apologize for it being a bit of a mess- It’s a year old and I never wrote it for anyone who isn’t me’s use haha

code
import requests
import json
import os

CONNECT_SID = ""

api_links = {
  "item shop" : "[INSERT MAIN GIMKIT PAGE HERE]/api/cosmos/item-shop",
  "login" : "[INSERT MAIN GIMKIT PAGE HERE]/api/login",
  "basics" : "[INSERT MAIN GIMKIT PAGE HERE]/api/cosmos/basics",
  "set cosmos" : "[INSERT MAIN GIMKIT PAGE HERE]/api/cosmos/select-cosmetic",
  "buy cosmos" : "[INSERT MAIN GIMKIT PAGE HERE]/api/cosmos/purchase-item",
  "create set" : "[INSERT MAIN GIMKIT PAGE HERE]/api/v1/editor/create",
  "get cosmos" : "[INSERT MAIN GIMKIT PAGE HERE]/api/cosmos/owned-cosmetics"
}



if "Cosmos":
  def skinURL(skinID):
    skinID = skinID.replace("character_", "")
    return f"[INSERT MAIN GIMKIT PAGE HERE]/assets/map/characters/spine/preview/{skinID}.png"
  def stickerURL(stickerID):
    stickerID = stickerID.replace("sticker_", "")
    return f"[INSERT MAIN GIMKIT PAGE HERE]/assets/map/stickers/{stickerID}.png"

  def login(email, password):
    args = {
      "email" : f"{email}",
      "password" : f"{password}",
      "googleToken" : ""
    }
    session = requests.Session()
    r = session.post(api_links["login"], data=args)
    try:
      return session.cookies.get_dict()['connect.sid']
    except: #login failed
      return None



  def getItemShop(session):
    cookies = {
      "connect.sid" : session
    }
    r = requests.get(api_links["item shop"], cookies=cookies)
    cookies = None
    return json.loads(r.text)
  def getLevelingData(session):
    cookies = {
      "connect.sid" : session
    }
    r = requests.get(api_links["basics"], cookies=cookies)
    cookies = None
    return json.loads(r.text)
  def setCosmos(session, cosmosID):
    cookies = {
      "connect.sid" : session
    }
    args = {
      "cosmeticId" : cosmosID,
      "cosmeticType" : "character",
    }
    r = requests.post(api_links["set cosmos"], cookies=cookies, data=args)
    cookies = None
    return r.text
  def buyCosmos(session, cosmosID):
    cookies = {
      "connect.sid" : session
    }
    args = {
      "cosmeticId" : cosmosID,
    }
    r = requests.post(api_links["buy cosmos"], cookies=cookies, data=args)
    cookies = None
    try:
      return json.loads(r.text)
    except:
      return "OK"


  def getCosmos(session):
    cookies = {
      "connect.sid" : session
    }
    r = requests.get(api_links["get cosmos"], cookies=cookies)
    cookies = None
    return json.loads(r.text)

  def trailURL(trail_id):
    return f"[INSERT MAIN GIMKIT PAGE HERE]/assets/map/trails/{trail_id}/particles.png"

Here is an example of the code in action:

session = login("blackhole@example.com", "abc123")
setCosmos(session, "diamondRainbow")

Also, when using the code, replace [INSERT MAIN GIMKIT PAGE HERE] with the gimkit url, since I’m not able to post gimkit urls on the forums.

2 Likes

Yeah- this is all modding stuff, it’s not known really well, and as far as I know there are only maybe 5-10 people outside of the dev team that know how to mod gimkit.

2 Likes

Oh ok, so how and what type of code do i need to use to start learning gimkit modding? I just started JS, CSS and HTML 4 days ago. I just wanted to start learning more complex things, and how would I even start to learn how to do python?

Modding is done within Javascript. However, the API can be used with any language. As I mentioned above, the gimhook discord server is the place you want to go for modding things.

2 Likes

K, I will look in to it. Thanks for the tips though.

1 Like

Oh- just saw the new edit. The Colyseus instance can only be accessed through inspect element at the moment. All mods are written in JS, so for a block copying mod, you would need to use JS.

1 Like

Yeah- lemme amend that. The undeniably best way to mod gimkit is just through inspect element with JS. Adding an in-between medium just makes things harder.

Also, the standard for modding is to write mods in JS, and load mods from JS, so you should probably write your mod in JS, or in something that can compile it to JS.

2 Likes

Alright… you’re not gonna have the best time learning to mod that way, but ok…
Also, this is a great opportunity to learn JS- I learned JS through modding gimkit :slight_smile:

2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.