glitch-api
A Node.js module that allows you to easily interact with the Glitch API
📖 Documentation | ✨ Examples |
---|
Features
- 99% coverage of the known Glitch API
- Uses TypeScript that provides hints in editor, type checking, etc.
- Supports WebSocket connection to the Glitch editor
- Support for authorization
- Only two dependencies:
node-fetch
andalgoliasearch
- Class abstraction
- Works with both API versions
this unofficial site and my researches
Warning: this module uses unstable API that hasn't been officially released yet. Described only world-open methods fromInstallation
Node.js 8.0.0 or newer is required
NPM
npm i glitch-api -s
Example usage
// Require using ES6 syntax // Or using old fancy styleconst Glitch = // Init main classconst glitch = token: 'xxx' // Put here your Glitch token or use glitch.setAnonToken()const api = glitch // Get a user profileapiusers // → User
❗ Migration from 2.x to 3.x
- Any search method now follows the same syntax:
.search(s: string) → Algolia result
- Remixing a project doesn't return
joinLink
. Now it is aProject
instance. Consider getting project data with token viaapi.projects.get()
- Token is absolutely required. If you don't have a token, consider using
Glitch.setAnonToken()
. For more info, see examples/anonymous.js
Q&A
How do I get Glitch token?
Paste the following code to the browser's console on the Glitch editor page:
JSONpersistentToken
Also you can use Glitch.setAnonToken() → Promise<string>
method to login as an anonymous user and use its token.
Why *api-method* is not implemented?
Because I'm also human and I might not have seen the recent changes in Glitch's API. Anyway, PRs are open for anyone :)
The *api-method* is not working.
It could be that Glitch devs removed the support for that method. Or it's just a my fault. Open a new issue and describe what's happend.
Contribution
Feel free to open new Pull request or an issue!
Credits
Made by jarvis394 with ♥️
- VK: @tarnatovski
- git: @jarvis394