Topic

Staff Topic

Glitch API

We're just about ready to start testing access to the glitch API. If you'd like to build something (or already have!), tell us about it!

You can create your API key here: api.glitch.com/keys/

More details: api.glitch.com/#auth
Spec: tools.ietf.org/html/draft-ietf-oauth-v2-13

Posted 22 months ago by Bees! Subscriber! | Permalink

Replies

  • Accy, scroll up for instructions on how to request one.

    As for permanence: we'll see! Everything is still up in the air for now. Probably, in the long run, new (post-Beta) keys will be issued.
    Posted 20 months ago by stoot barfield Subscriber! | Permalink
  • Just a bit OT here... 'cause I barely understand a *thing* anybody is saying here...  But I *think* all this talk is the reason I now have a link on my Glitch homepage to start skills... and I *think* this is why I can now see which Badges I have yet to earn...

    If I'm understanding this correctly, then I want to thank Stoot (et al) for allowing and/or providing for this sort of player input!  And, of course, thanks to the players stepping up.

    What a unique game!  So happy to be part of the start up!
    Posted 20 months ago by Pirate Apples Subscriber! | Permalink
  • Hi

    Not planning on doing a web based app but a smart phone one - so lets call it AccysGlitchApp

    therefore not web address - can i still get a key?
    Posted 20 months ago by Accy Subscriber! | Permalink
  • i should build something...
    Posted 20 months ago by Another Chris Subscriber! | Permalink
  • Hi - any chance of the API key?  Did say I am planning on an app for my phone rather than a website - dont know if this makes a difference?
    Posted 19 months ago by Accy Subscriber! | Permalink
  • is there any way that we can get the item type (from the encyclopedia) in the Item Definition (item_def) in auction.list method?
    If not, its OK. Thanks!
    Posted 19 months ago by NathanG Subscriber! | Permalink
  • Accy, you still need a URI to call back to. Otherwise, you can't get a token and you won't be able to authenticate. You can use something like AccysGlitchApp://auth

    Quoting from another helpful developer doing an iphone app:

    Apple allows iOS developers to register custom URI schemes (insert-scheme-here://) so that iOS will open up the app and send the full URI to the application.

    In the app, you'd be able to implement the following method which will be messaged when the app opens via the custom URIscheme.

        - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url

    Your NSURL object would be something like this:

        AccysGlitchApp://auth?oauth_token=xxx&token_type=yyy&scope=zzz&state=aaa

    Then you could store the oauth access token and use it to auth the users.

    See: developer.apple.com/library...
    Posted 19 months ago by stoot barfield Subscriber! | Permalink
  • NathanG: not sure what you mean by item type. can you give an example?
    Posted 19 months ago by Bees! Subscriber! | Permalink
  • Thanks stoot - will check it out when I get more time and then let you know the address
    Posted 19 months ago by Accy Subscriber! | Permalink
  • @Bees! - I presume @NathanG means 'Food', 'Drink', 'Tool', 'Other' - which I agree would be very useful.
    Posted 19 months ago by dopiaza Subscriber! | Permalink
  • @Bees: @dopiaza is correct. The category of the item as he mentioned.
     
    Posted 19 months ago by NathanG Subscriber! | Permalink
  • Please set up two for me.

    1. 
    redirect_uri: http://glitchtracker.com/auth/
    app name: GlitchTracker

    2.
    redirect_uri: glitchtracker://auth/
    app name: GlitchTrackerMobile
    Posted 19 months ago by BasicallyRun Subscriber! | Permalink
  • A request to all wonderful Glitch GreaseMonkey script developers.  Is it possible to limit the authorizations to just your application site , instead of 'Allow access to all web sites'. I can't recall but only one of the apps limits the access to it's site while others ask access to all sites. Eitherway, I am a big fan of your apps and they made the whole game playing experience even more pleasurable.
    Posted 19 months ago by gia Subscriber! | Permalink
  • Gia - the nature of Greasemonkey scripts is that they request general access.
    I can assure you, however, that at least the ones I've worked on (the location checker and the favor checker) don't do anything except what they're advertised to do.
    Posted 19 months ago by Lord Tweedmouth Subscriber! | Permalink
  • And perhaps more specifically - Greasemonkey scripts have a few lines at the top that say the websites that the script should be run on. The script will never be run on any other website, because those lines restrict the script to specific pages. All of the scripts I've listed in the thread only run on the Glitch website, and if I remember correctly, they all restrict themselves to just a specific page! You shouldn't worry about those.

    The reason why you got that message from Chrome is because some scripts are not very specific about what websites they run on, and sometimes run on webpages they don't intend. It's sometimes difficult to figure out where exactly the script will run, which is why Chrome will tell you that it needs "access to all websites", but for scripts like ours, it makes things seem much scarier than it needs to. Your concern is perfectly valid, though!

    Just to let you know - now that I've looked into it, there actually is a way to have Chrome display where the script is run, and I will be updating my scripts to make things more clear.

    (and if you have any follow up, we've got a Greasemonkey specific thread here.)
    Posted 19 months ago by Dave Subscriber! | Permalink

  • Hi Stoot - ok think I might be on to something - can you set me up with a key

    redirect_uri:    AccysGlitchApp://auth
    app name:   AccysGlitchApp
    Posted 19 months ago by Accy Subscriber! | Permalink
  • Thank you Dave and Lord for addressing my concern :) Can't wait to see what you two come up with next !
    Posted 19 months ago by gia Subscriber! | Permalink
  • BasicallyRun: your 2 keys have been created
    Accy: your key has been created

    NathanG: I've filed a bug with Simon, who is working on auctions at the moment. He'll post here when it's done.
    Posted 19 months ago by Bees! Subscriber! | Permalink
  • Hi,

    I'd like to start experimenting with this and would appreciate a key.  Will think of porting to iOS later if I get it to run in desktop browsers first.

    redirect_uri: glitch.everything-on-it.com/auth
    App Name: Everything On It for Glitch

    Thanks.
    Posted 19 months ago by Snuffleupagus Subscriber! | Permalink
  • TY Bees
    Posted 19 months ago by Accy Subscriber! | Permalink
  • NathanG: auctions.list will now return the category for each auction. Note: the value is returned in the main body of the auction, not in the item def. I did it this way for 2 reasons:

    (1) It means you don't have to call and retrieve the item def if you're only interested in the category.
    (2) The data is less expensive to fish out that way :)

    As a super-special bonus, you can also pass a "category" parameter which will limit the returns to only show auctions which fall under that category. The list of accepted values for this parameter is in the API docs.

    Finally, auction items are now filed under the same category as they are in the encyclopedia (previously, auctions only had "food", "drink", "tools" and "other"). This is true across the whole system, including the on-site auction pages.

    Let me know if you see any bugs!
    Posted 19 months ago by hitherto Subscriber! | Permalink
  • A couple more requests (there are always more, aren't there...)

    1) Can we have this info in players.inventory too
    2) and can we include "storage" in that set of possible values when appropriate...

    (and of course, there are more requests coming :-) )
    Posted 19 months ago by dopiaza Subscriber! | Permalink
  • Snuffleupagus: your key has been created
    Posted 19 months ago by Bees! Subscriber! | Permalink
  • hitherto - Woohoo Awesome! I am excited to play with it. I'll let you know if I see anything. Thanks!
    Posted 19 months ago by NathanG Subscriber! | Permalink
  • Thanks for setting those up, Bees!
    Posted 19 months ago by BasicallyRun Subscriber! | Permalink
  • Do I need a key if I only want to use the app for myself?
    Posted 19 months ago by Taral Subscriber! | Permalink
  • @Taral - no you don't need a key to use the apps
    Posted 19 months ago by Divine~ Subscriber! | Permalink
  • I meant if I want to write an app to use the API, but only for myself. It looks like the answer is "kind of".

    Any chance of getting https on api.glitch.com?
    Posted 19 months ago by Taral Subscriber! | Permalink
  • Oh, and ZOMG enormous response on listLearning. There's a *lot* of duplicate data in there - any chance of simplifying it?
    Posted 19 months ago by Taral Subscriber! | Permalink
  • Key: yes, you'll need one.
    HTTPS: yes, good idea. it's planned, but i haven't thought about it in a while
    listLearning: wow, yes! we should figure some way to make it less crazy (not nesting requirements would be a good start)
    Posted 19 months ago by Bees! Subscriber! | Permalink
  • More data problems:

    skills.listAvailable gives the required skills (not so useful, since we know you have them), but it doesn't give the stuff this skill unlocks (useful). It also doesn't have "state", so I can't use "state.post_reqs".

    Should I start a new thread for these?
    Posted 19 months ago by Taral Subscriber! | Permalink
  • Sorry if I keep requesting stuff, but, it would be completely awesome if we could get a list of the current users friends. I would like to show what your friends are auctioning (Shh..don't tell, it is a secrete update ;P).
    Thanks so much!
    Posted 19 months ago by NathanG Subscriber! | Permalink
  • Another data problem: When you're not learning anything, listLearning returns {"ok":1,"learning":[]}, but learning is supposed to be an object, not a list!
    Posted 19 months ago by Taral Subscriber! | Permalink
  • I have a request that the API be expanded so that you can also get a list of the items in your home.  Or at least what's in the bags in the cupboard. 
    Posted 19 months ago by WindBorn Subscriber! | Permalink
  • dopiaza: "category" will now be included in the "defs" for any item. This should be true across all API methods that list items with the "defs" parameter.

    And yes, storage etc will have the correct category (internally, that's "container" - live with it ;) ), even for items that don't show up in some contexts, like auctions.

    Taral: I'll be looking at cleaning up listLearning sometime this week. The empty return for listLearning looks right to me already - it's possible someone tweaked that when I wasn't looking. I'm not sure that the data is going to be easily available to add unlocks to skills.listAvailable, but I'll look into it.

    NathanG, WIndBorn: both "buddylist" and "cabinet contents" are probably good methods for us to have. They're on my list to get done whenever I have enough spare cycles.
    Posted 19 months ago by hitherto Subscriber! | Permalink
  • Just a further question on Windborn's request - will there be a larger number of unauthenticated methods available? It'd be great to get information on, oh, I dunno, the most popular piggie on a daily basis or the busiest location in the game etc? Y'know, methods that don't require access to specific player information, but more general info.
    Posted 19 months ago by Stevie Prickles Subscriber! | Permalink
  • The problem is one of datatypes. [] is a list. {"bog_specialization": ...} is an object, NOT a list. It plays havoc with decoding. :(

    Since there's only supposed to be one skill being learned at a time, why not making learning be the skill object itself, or null if nothing is being learned?

    Re: unlocks, I can already get them (mostly), but it's a real pain -- I search for the unlocks of the first dependency, and then get unlocks from that.
    Posted 19 months ago by Taral Subscriber! | Permalink
  • ... sorry, again expanding on that (now I've had a thinky), e.g. how about an unauthenticated call to collate all notes with certain hashtags/keywords?

    I guess that's a bigger subject altogether.
    Posted 19 months ago by Stevie Prickles Subscriber! | Permalink
  • oh, and sorry Bees, but could I have an client ID:

    app name: RichWild Dev Glitch App
    redirect: dev.richwild.com/glitch/auth

    Ta.
    Posted 19 months ago by Stevie Prickles Subscriber! | Permalink
  • @Taral - with JS, you can always check if it's an object or an array using typeof.

    @Bees - are there any upcoming plans to expand the API?  If so, what?  If not, pretty please!
    Posted 19 months ago by Lord Tweedmouth Subscriber! | Permalink
  • @hitherto: Thanks - much appreciated! (And yes, I can live with 'container' - I was only using your terminology from its fleeting appearance in auctions :-) )
    Posted 19 months ago by dopiaza Subscriber! | Permalink
  • @hitherto - A buddy list would be much appreciated :D.  It would be awesome if it include what relationship they are to you (like player.fullInfo, is contact, is reverse contact) somehow. So you know if they are mutual friends, ect.
    Thanks a ton!
    Posted 19 months ago by NathanG Subscriber! | Permalink
  • @fiddle - done
    @Lord Tweedmouth - yes, with whatever is most needed
    Posted 19 months ago by Bees! Subscriber! | Permalink
  • Cheers Mr. Cal
    Posted 19 months ago by Stevie Prickles Subscriber! | Permalink
  • I would like a key Hallowed Spirit
    Posted 19 months ago by WarmSpirit Subscriber! | Permalink
  • I need a key too please but just for me. Repeating Taral's statement"I meant if I want to write an app to use the API, but only for myself. "


    Thanks.
    Posted 19 months ago by gia Subscriber! | Permalink
  • Hallowed/Taral/gia: even if it's just for yourself, you'll need a redirect URL if you want to be able to make authenticated calls. We'll probably give you auth tokens to use for yourself without having to set up auth, sometime in the future,
    Posted 19 months ago by Bees! Subscriber! | Permalink
  • @Lord Tweedmouth: I'm not using Javascript.

    @Bees: For now I'm just using the API Explorer's key, since there's no public endpoint to return_to. As soon as I have a public endpoint, I'll put it here.
    Posted 19 months ago by Taral Subscriber! | Permalink
  • @Bees - in that case, a request: can we see locations get some API love?  We could use it to make a more advanced pathfinder, among other things.
    Posted 19 months ago by Lord Tweedmouth Subscriber! | Permalink
  • @Lord Tweedmouth
    "@Taral - with JS, you can always check if it's an object or an array using typeof."


    Just as a general heads-up, in JS, both typeof {} and typeof [] will return the same: "object".  If you want to determine whether something is an array, then the belts-and-braces way to do so is:


    Object.prototype.toString.call(ambiguous_object_variable) === '[object Array]'
    Posted 19 months ago by La Esponja Grande Subscriber! | Permalink