Hi !
I’m EarlGray, admin of Korean Gather Community,( KorGather )
KorGather is Korea’s most popular GatherTown community with 5500 members.
The current community site is dependent on a portal site called Naver, so the degree of freedom is not high.
So i decided to create a new site as an extension of KorGather.
The new community is an SNS-type community where users can share their Space and interact through likes and comments. ModuMeta
And we provide a music object inserting API for map makers using Gather API.
As I wrote in the title, I wrote this post because there is an API that I think is essential while creating a site.
Shown in the picture below, GatherTown recent_space item has ‘numActive’ data in the upper left corner.
I would like to apply this feature to my community site as well through API.
Please make this API
1 Like
require ("isomorphic-fetch")
const {API_KEY, SPACE_ID_NUM, SPACE_NAME} = require ("./config.js")
const run = async () => {
console.log(API_KEY," ", SPACE_ID_NUM," ", SPACE_NAME)
const queryString = `{
gameData(spaceData:{
apiKey: \"${API_KEY}\",
spaceIdNum: \"${SPACE_ID_NUM}\",
spaceName: \"${SPACE_NAME}\"
}){
playerCount,
}
}`
const payload = JSON.stringify({ query: queryString });
const headers = {
'Content-Type': 'application/json',
'Content-Length': payload.length,
'User-Agent': 'Node',
};
const res = await fetch("https://gt-space-data.herokuapp.com/graphql",{
method: "post",
headers: headers,
body: payload
});
const json = await res.json();
console.log(json.data)
}
run();
Example output: { gameData: { playerCount: 3 } }
That should get you going. Notice, that endpoint (gt-space-data.herokuapp.com) is subject to change or going down for updates, as it is mostly in proof of concept stage. Be sure to secure your API key when using the query so client side users cannot access it.
2 Likes
woooooooooow
That’s what i need !!
This API made by GatherTown? or personal project?
Personal project, and one I am willing to develop a bit more as use-cases come up.
1 Like
Really amazing !
I can’t even imagine how to get the playerCount data for maps created by others with my API Key.
1 Like
Maybe a bit of a cat out of the bag, but your API key can go wherever your avatar can, and retrieve a lot of this data. Meaning if a space does not have a password or guestlist, you can pull the population data.
For example, the Gather Office has no access limit, meaning any API key can access data from it.
1 Like
As a note, I am actively changing this program to offer a lot of new capabilities for HTTPS style endpoints, giving access to things like Space settings (including use case, for those who need it), default spawn map, map names, etc. I will being adding a ‘full’ documentation post once I have it in a workable state.
1 Like