Hello everybody! Help me please. Can anyone have a Glitch API? Give a link to the documentation if available.
The Glitch API is not ready for public consumption yet so there are no official docs, but I am sure someone can help you out I’ve never used it myself
Eddie
Thank you the answer
There is simply a module that allows you to use the Glitch API. I checked it, but essentially nothing worked.
Yes, that’s the Glitch API npm package by @jarvis394.
@khalby786,I put it yesterday. The package does not work.
Yes, it does. If you know how to use it.
@khalby786, I know. I opened the documentation. But my VSCode did not want to work with him.
And why is that?
@khalby786, Honestly I do not know. I thought it did not work. After all, the Glitch API is not yet publicly available.
Make sure you have Git and npm installed.
Sorry, to clarify, it is available for you to use, it’s just not ready/designed for you to use it (e.g. public consumption)
Sorry if I confused you there.
Eddie
Hello @xyligan,
Can you please describe what’s gone wrong? Can you share screenshots or logs from the package examples?
Uff … I uninstalled the module already unfortunately …
Could you please remember what didn’t work with your VSC? Have you used a Glitch user’s token?
I can give only the sample code that I wrote.
const { Glitch } = require('glitch-api');
const glitch = new Glitch({ token: 'my token' });
const { api } = glitch;
if(cmd === `${prefix}project`) {
let messageArray = message.content.split(' ');
let cmd = messageArray[0];
let args = messageArray.slice(1);
api.projects.search(args[0]);
}
I received the token in the browser console by writing the following command:
(JSON.parse(localStorage.getItem('cachedUser'))).PersistentToken
@jarvis394, I use this docs: Click
Yep, searching is broken because Glitch now uses Algolia API. I’ll see what I can do here.
Also, .search
returns Promise, therefore you have to use .then
construction or async/await
.
I think you can use projects.get with project domain: https://glapi.ml/classes/projects#get
const project = await api.projects.get({ domain })
@jarvis394, I need to do a search by name, not a link.
Please update the module as updates to the Glitch API arrive.
Yep,
- Get Algolia creds by api.glitch.com/v1/search/creds
- Get search query from
https://las7vgsqiq-dsn.algolia.net/1/indexes/search_collections/query?x-algolia-agent=Algolia%20for%20JavaScript%20(3.35.1)%3B%20Browser%20(lite)
with id, token and post data as { params: ‘query=’ }
No, domain is a project name.
I just need to display project statistics by reference. That’s why I do it
I’ve updated the package, everything should be okay now.
You can see search example in here: https://github.com/jarvis394/glitch-api/blob/master/docs/examples/search.js
Does the project name search work?