Save API

  • Marte2007
    27th Aug 2011 Member 0 Permalink
    I think that an API to access the saves' data would help those who would like to post their creations outside this site.
    It might be like this: you request a save by its ID and the server returns the data encoded in some way, for example JSON:

    returns:
    {
    'id':'467931',
    'name':'Mini Bombshooter',
    'author':'Lord-Spectre',
    'preview':'url to preview image'
    }

    or XML:

    returns:
    <save id="467931">
    <name>Mini Bombshooter</name>
    <author>Lord-Spectre</author>
    <preview>url to preview image</preview>
    </save>


    P.S. to moderators: I don't want to publicize my save in the examples above, if you want I'll change it to a neutral one
    P.S. to developers: If you approve ths but need help coding it, I could help...
  • Simon
    27th Aug 2011 Administrator 0 Permalink
    https://powdertoy.co.uk/Browse/View.json?ID=467931
    Json has been implemented since forever, No XML though
  • Marte2007
    27th Aug 2011 Member 0 Permalink
    So it just changes "html" to "json" in the save's URL? Great, thank you and who had this great idea.
    P.S. XML was only an example
    EDIT: no preview... any chanche this will be added?
    EDIT2: This also work with users' profiles, but not with users' saves list. Again, will this be implemented?
  • Simon
    27th Aug 2011 Administrator 0 Permalink
    Save preview is based on ID: https://powdertoy.co.uk/GetScreenshot.util?ID=446423&Size=small
    You may use https://powdertoy.co.uk/Browse.json to get user specific saves (e.g. query "user:Simon")
    The whole forum has a JSON API.
  • CaptianKirk
    27th Aug 2011 Member 0 Permalink
    ummm i hate to tell you, those links are broken...kinda. The first one gives what would appear to be wingdings on my computer, and the 2nd shows data for the saves, but no images. (either something is broken, or i am just stupid, I do real computer coding, not much web based stuff)

    EDIT: its not wingdings, its just all sorts of characters
  • Marte2007
    27th Aug 2011 Member 0 Permalink
    The first returns an image, so binary data that seems strange characters. Try to save it with extension .png and open it with an image viewer.
    EDIT: I didn't understand how to

    Simon:

    query "user:Simon"
  • Simon
    27th Aug 2011 Administrator 0 Permalink
    @Lord-Spectre (View Post)
    https://powdertoy.co.uk/Browse.json?Search_Query=user%3ASimon

    Also, I fixed the preview script so it sends the correct mimetype.