LoginLogin

SmileBASIC API

Root / Submissions / [.]

MasterR3C0RDCreated:

Announcement (10/06/2020):

I just wanted to let anyone who wanted to use this API know that this is pretty safe to use. All downloaded files are cached, and as such it avoids sending more than the required amount of requests to SmileBASIC servers. If you're doing a large amount of automated queries at one time, please check out the WebSocket Query API, as it provides less overhead on the server and adds additional features like queueing requests. Also, there might be a new feature soon :) Quick jump: News Introduction Usage Examples SiteJS plugin Credits WebSocket Query API

NEWS:

  • 03/26/2020: Fixed a bug that was causing long load times. I don't know if anyone noticed this, but it was taking like 3 seconds per request. Not any more!
  • 03/16/2020: Added English tag support! When using the `info` endpoint, add ?en=1 for the official English tags. They haven't been updated but should give a better idea of what each tag is. This also works with ?json=1 and the WebSocket Query API!
  • 02/29/2020: Added tags to the info page! Only Japanese tags for now because official tag data for English is not very good right now, but will be updated in the future!
  • 02/04/2020: WebSocket query API implemented! Read more details below.
  • 01/31/2020: SBAPI 4 has launched! If you're using the SBAPI SiteJS, please update it to support SB4 keys.
Introduction SmileBASIC API (SBAPI) is a service created by me (MasterR3C0RD) and triangle, with help from Yttria, 12Me21, and snail_, that allows you to get info for and download programs directly from SmileBASIC 3 servers. Not only is this useful for moderators to check if a key is still available, it also allows users to post GRPs to the forums as a PNG. Usage: Everything in SBAPI is simply a URL. The basic URL format for keys is http://sbapi.me/get/(key)[/(filename)]/(encoding), where anything in [] is optional and anything in () is required. key should be replaced with the public key, and filename allows you to choose a specific file if the key is a project. The encoding is required and can be one of the following:
  • info - all files, shows information about the file provided (use ?json=1 if you're writing a program to get information as JSON, add en=1 for English tags)
  • list - only projects, lists all files (use ?json=1 if you're writing a program to get information as JSON)
  • zip - only projects, download all files from the project as a ZIP file. If you want to convert files to their preferred format (ex, GRP -> PNG, TXT -> Text), add ?nice=1
  • raw - all files, downloads the raw file.
  • text - only TXTs, returns the text content of the file
  • code - only TXTs, highlights code using 12Me21's SBHighlight library (use ?wrap=1 to enable word-wrapping)
  • png - only GRPs, converts the GRP to a PNG
  • json - only DATs, returns the DAT information as a JSON array of arrays.
  • csv - only 2D DATs, converts the data to a CSV (comma-separated values) file
  • icon - only META files, returns the icon as a PNG file.
  • downloads - all files, returns a PNG with the download count (download count is only updated every 24 hours). You can also control the PNG using query parameters: ?color=#BADA55&stroke=#A55A55&strokewidth=3&padding=3&bgcolor=rgba(0,0,0,0.5)
  • encodings - all files, returns JSON array with all possible encodings for the file given
Other encodings may be added in the future. Examples: Disclaimer: Authors of projects or assets displayed on this page are not associated with and have not contributed to the SmileBASIC API project. This can be used when asking people to debug code on the forums. Posting a public key and a link to the code could make debugging much easier. Example: http://sbapi.me/get/CKANY53Y/TN_SHARP/code (Phil's N# compiler) Output: Wanting to show off your sprites is another possible use. Simply use the PNG endpoint. Example: http://sbapi.me/get/4DH5P4K3/BBG_TIKI/png (sprites from cujo1992's Tiki Descent) Output: You can also back up your project as a ZIP file if you need to be sure you'll always have it. Example: http://sbapi.me/get/P3T43E3V/zip (kantackistan's Virtual Buffalo) Output: Don't forget a download counter to gauge how popular your programs are! Note that the download count is not real time, and only updates every 24 hours. Example: http://sbapi.me/get/QK4N3PZF/downloads (calc84maniac's Spooky Maze Raycaster demo) Output: Optional SiteJS: If you think it's too much of a hassle to have to go through the API to check out information about programs, you have a similar mindset to I. That's why me and 12Me21 wrote a SiteJS, available at http://sbapi.me/sbapi-sbs.js that adds an extra section to pages that looks something like this: Simply copy and paste the contents into your SiteJS and load up a program page. After a few seconds, the information will load and be shown on the page. WebSocket Query API If you're doing multiple requests, the best way to accomplish this is using the WebSocket Query API. Simply connect to ws[s]://sbapi.me/get and send a request, and you'll get something back. You can either do: Request: (key[/version[/filename]]) info [prop1,prop2.subprop2] - Gets information about a program. Response: (key[/version[/filename]]) (value) - Value will either be the entire JSON-encoded info object (if no properties are provided), a single JSON-encoded value (if one property is provided), or a JSON-encoded object of all properties requested and their values (if multiple properties are provided). This info object uses a different format than the `info` encoding, test it first by not providing any property arguments. OR Request: (key[/version[/filename]]) download [encoding[?options]] - Gets the file as a specified encoding (or the raw file if none is specified). Any encodings that allow options work exactly the same as if options were provided Response: (key[/version[/filename]]) (filename) (datalength) (data) - Datalength will be the ASCII representation of the size of the data returned, and data will be the response of the encoding. If a request fails, you will get a response similar to such: (key[/version[/filename]]) FAIL If you get this and you're sure you're not doing anything wrong, send me a DM and I'll take a look. NOTE: Send multiple requests separated by \n, eg, `KEY1 info\nKEY2 info` or otherwise you will end up never getting a response in the end. Some requests async are fine, but not all. Credits
  • triangle - file format guru, wrote the file parser used for SB files and other parts of code, and most of reverse engineering of SmileBASIC's servers, donated 3DS information for the server
  • MasterR3C0RD - hosting, wrote the server communication libraries and helped with reverse engineering of SmileBASIC's servers
  • 12Me21 - wrote sbhighlight and rewrote the SiteJS plugin to work with more browsers
  • snail_ - working on proper documentation for API
  • Yttria - word of reason, helped with multiple things internally
  • Jaku - helped with SB4 support

Replying to:MasterR3C0RD
Hey, I'm considering adding a couple of new features, but in order to keep the server running and to cover the additional risk, I'm considering making it subscription-based. Basically, the feature I'm considering is directly uploading programs from your computer. The way I'm thinking that I'll implement this is either allowing people using homebrew to link their own 3DS information to upload programs to their own account, or allowing people to upload one program at a time to the account currently in use for SBAPI. I could probably implement both, but the question remains if there is anyone that would pay for this service. The amount I'm considering is a meager USD$2/month, and I'd likely work on creating integrations for software like VSCode and the like. Not having to worry about the server costs (which I'm currently paying out of pocket) will motivate me more to add more features and work on more interesting ideas that I've had for SBAPI for a while, and maybe I'll be able to focus my attention on adding SB4 support (though I can't guarantee it's possible). So TL;DR, would anyone be willing to pay to allow uploading programs directly from your computer? EDIT: Quick note that this won't change any of the functionality currently available. SBAPI downloading and information grabbing will always be free, for as long as it stays running. [poll=p680][/poll]
Account sharing? Also, will there be an option for storage? Like, rather than storing the current version on the SmileBoom server, store it on your server for easier access?
Account sharing is something I've thought about a little and is still something I'll have to consider. I mean, if someone wanted to share their account with a friend I wouldn't care, but if we're saying "here's a password so that everyone can use the donator functionality" the hammer will come down. I likely won't be handling login myself anyways, probably Google or Twitter can handle that for me. Storing on my server makes little to no sense to me since you can't download in SB directly from my server (for now...). You could just save the files to Google Drive/Dropbox/OwnCloud/whatever and it'd be about as useful. I'm also considering even making it like a lifetime fee of USD$25 since people have brought up that it would be difficult to get a subscription for a programming tool for their Nintendo. If that would change the minds of the majority to consider paying for upload services, let me know. If you even have other ideas as to features that you would pay for, seriously DM me or something. I just want to make sure that this thing can keep running when I start needing to pay for uni in the fall. If uploading isn't it, maybe it's download stats for your programs or even something like storing SB files in the cloud. I want to work with the community to find something we can all agree upon.

Replying to:MasterR3C0RD
Hey, I'm considering adding a couple of new features, but in order to keep the server running and to cover the additional risk, I'm considering making it subscription-based. Basically, the feature I'm considering is directly uploading programs from your computer. The way I'm thinking that I'll implement this is either allowing people using homebrew to link their own 3DS information to upload programs to their own account, or allowing people to upload one program at a time to the account currently in use for SBAPI. I could probably implement both, but the question remains if there is anyone that would pay for this service. The amount I'm considering is a meager USD$2/month, and I'd likely work on creating integrations for software like VSCode and the like. Not having to worry about the server costs (which I'm currently paying out of pocket) will motivate me more to add more features and work on more interesting ideas that I've had for SBAPI for a while, and maybe I'll be able to focus my attention on adding SB4 support (though I can't guarantee it's possible). So TL;DR, would anyone be willing to pay to allow uploading programs directly from your computer? EDIT: Quick note that this won't change any of the functionality currently available. SBAPI downloading and information grabbing will always be free, for as long as it stays running. [poll=p680][/poll]
Think about it this way: when someone runs a key through SBAPI, the files are permanently cached in your storage. Uploading could do the exact same thing.

Replying to:MasterR3C0RD
Hey, I'm considering adding a couple of new features, but in order to keep the server running and to cover the additional risk, I'm considering making it subscription-based. Basically, the feature I'm considering is directly uploading programs from your computer. The way I'm thinking that I'll implement this is either allowing people using homebrew to link their own 3DS information to upload programs to their own account, or allowing people to upload one program at a time to the account currently in use for SBAPI. I could probably implement both, but the question remains if there is anyone that would pay for this service. The amount I'm considering is a meager USD$2/month, and I'd likely work on creating integrations for software like VSCode and the like. Not having to worry about the server costs (which I'm currently paying out of pocket) will motivate me more to add more features and work on more interesting ideas that I've had for SBAPI for a while, and maybe I'll be able to focus my attention on adding SB4 support (though I can't guarantee it's possible). So TL;DR, would anyone be willing to pay to allow uploading programs directly from your computer? EDIT: Quick note that this won't change any of the functionality currently available. SBAPI downloading and information grabbing will always be free, for as long as it stays running. [poll=p680][/poll]
So you mean more like an archive of sorts? That would be fine. I have plenty of storage, SB files don't use up much space. I will have limits of course though

Replying to:MasterR3C0RD
Hey, I'm considering adding a couple of new features, but in order to keep the server running and to cover the additional risk, I'm considering making it subscription-based. Basically, the feature I'm considering is directly uploading programs from your computer. The way I'm thinking that I'll implement this is either allowing people using homebrew to link their own 3DS information to upload programs to their own account, or allowing people to upload one program at a time to the account currently in use for SBAPI. I could probably implement both, but the question remains if there is anyone that would pay for this service. The amount I'm considering is a meager USD$2/month, and I'd likely work on creating integrations for software like VSCode and the like. Not having to worry about the server costs (which I'm currently paying out of pocket) will motivate me more to add more features and work on more interesting ideas that I've had for SBAPI for a while, and maybe I'll be able to focus my attention on adding SB4 support (though I can't guarantee it's possible). So TL;DR, would anyone be willing to pay to allow uploading programs directly from your computer? EDIT: Quick note that this won't change any of the functionality currently available. SBAPI downloading and information grabbing will always be free, for as long as it stays running. [poll=p680][/poll]
It would basically give them google drive for SmileBASIC. There would be a directory for the project, which could be uploaded at any time. There would also be room for various team members to upload code. So, for example, someone could work on an improved set of functions, and upload it to the server. Then, when everyone agrees to publish it, they send it. Benefits: -Allows for easy rolling-release -Easy collaboration without having to use an external service. This only makes sense if uploading to SB servers is possible.

Replying to:MasterR3C0RD
Hey, I'm considering adding a couple of new features, but in order to keep the server running and to cover the additional risk, I'm considering making it subscription-based. Basically, the feature I'm considering is directly uploading programs from your computer. The way I'm thinking that I'll implement this is either allowing people using homebrew to link their own 3DS information to upload programs to their own account, or allowing people to upload one program at a time to the account currently in use for SBAPI. I could probably implement both, but the question remains if there is anyone that would pay for this service. The amount I'm considering is a meager USD$2/month, and I'd likely work on creating integrations for software like VSCode and the like. Not having to worry about the server costs (which I'm currently paying out of pocket) will motivate me more to add more features and work on more interesting ideas that I've had for SBAPI for a while, and maybe I'll be able to focus my attention on adding SB4 support (though I can't guarantee it's possible). So TL;DR, would anyone be willing to pay to allow uploading programs directly from your computer? EDIT: Quick note that this won't change any of the functionality currently available. SBAPI downloading and information grabbing will always be free, for as long as it stays running. [poll=p680][/poll]
If I add collaboration features I might as well add in analytics of sorts, so yeah this really adds a lot of different use cases. I'm thinking I could start adding a lot of different features based around extra functionality SB can't provide so I can definitely get stuff set up to work with this.

Replying to:MasterR3C0RD
Hey, I'm considering adding a couple of new features, but in order to keep the server running and to cover the additional risk, I'm considering making it subscription-based. Basically, the feature I'm considering is directly uploading programs from your computer. The way I'm thinking that I'll implement this is either allowing people using homebrew to link their own 3DS information to upload programs to their own account, or allowing people to upload one program at a time to the account currently in use for SBAPI. I could probably implement both, but the question remains if there is anyone that would pay for this service. The amount I'm considering is a meager USD$2/month, and I'd likely work on creating integrations for software like VSCode and the like. Not having to worry about the server costs (which I'm currently paying out of pocket) will motivate me more to add more features and work on more interesting ideas that I've had for SBAPI for a while, and maybe I'll be able to focus my attention on adding SB4 support (though I can't guarantee it's possible). So TL;DR, would anyone be willing to pay to allow uploading programs directly from your computer? EDIT: Quick note that this won't change any of the functionality currently available. SBAPI downloading and information grabbing will always be free, for as long as it stays running. [poll=p680][/poll]
To combat password sharing, you could make it so that you could only upload 1 project every set amount of time. I don't know how well that would work though, or if people would be super annoyed by that.

Replying to:MasterR3C0RD
Hey, I'm considering adding a couple of new features, but in order to keep the server running and to cover the additional risk, I'm considering making it subscription-based. Basically, the feature I'm considering is directly uploading programs from your computer. The way I'm thinking that I'll implement this is either allowing people using homebrew to link their own 3DS information to upload programs to their own account, or allowing people to upload one program at a time to the account currently in use for SBAPI. I could probably implement both, but the question remains if there is anyone that would pay for this service. The amount I'm considering is a meager USD$2/month, and I'd likely work on creating integrations for software like VSCode and the like. Not having to worry about the server costs (which I'm currently paying out of pocket) will motivate me more to add more features and work on more interesting ideas that I've had for SBAPI for a while, and maybe I'll be able to focus my attention on adding SB4 support (though I can't guarantee it's possible). So TL;DR, would anyone be willing to pay to allow uploading programs directly from your computer? EDIT: Quick note that this won't change any of the functionality currently available. SBAPI downloading and information grabbing will always be free, for as long as it stays running. [poll=p680][/poll]
That's not a good idea, and would definitely not combat the issues at hand. It's more likely going to be based on IPs or simply monitoring for shared usernames/passwords on forums.

This is great news! How did you finally get SB4 support working?

Replying to:HTV04
This is great news! How did you finally get SB4 support working?
I can't explain how I got it working, but just that it works :)

Replying to:HTV04
This is great news! How did you finally get SB4 support working?
don't you mean...;)

Replying to:HTV04
This is great news! How did you finally get SB4 support working?
Cool, can't wait to see it in action!

Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?

Replying to:CyberYoshi64
Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?
All of it is from SB servers. How else does SmileBASIC get this information, magic? :P

Replying to:CyberYoshi64
Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?
Of course it's magic for me cuz I don't even have a Switch to see this.

Replying to:CyberYoshi64
Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?
Also you don't need an online subscription to use SB4, just a Japanese Nintendo account

Replying to:CyberYoshi64
Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?
and an sb4 pass to upload programs 500 yen per pass each pass grants you 10 program slots no limit to how many passes you can have

Replying to:CyberYoshi64
Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?
how do these passes work? are they like SB3 gold membership or will they never expire? Also, do I need to buy japanese eShop funds or how do I get money for the japanese account? cuz my credit card isn't supported by nintendo eShop. ~4,50€ for one pass? ok EDIT: How do I make the japanese account?
SpoilerChange the language to japanese and use japan as the country for the account?

Replying to:CyberYoshi64
Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?
1. You have each pass you purchase forever. 2. I don't think there's any way to add funds to a nintendo account other than using an eshop card and using a credit card and I don't think you can use an American or European eshop card on a Japanese account. so uh yeah buy a Japanese eshop card like everyone else EDIT:3. First, make a Nintendo account on a PC or Mobile Device. Make sure to choose Japan as the region of the account. Secondly, create a new profile on your Switch. The quickest way to create a new profile is by pressing the + icon (not the actual + button on the console) when starting a game. Thirdly, Go to the page of the profile. You can get there by selecting its profile picture in the top left of the home menu. Fourthly, Hit the Link a Nintendo Account button that appears at the bottom of the main page. Fifthly, simply enter the username and password of the Nintendo account. (or email and password, idk which one it is) And you're done! No switching of the Switch's language required!

Replying to:CyberYoshi64
Mind = Blown And all these infos are coming from the SB servers? My mind will blow further if it does. EDIT: Just a question, though it makes sense anyway but: When I only pay Switch Online once, will it preserve what I've uploaded?
The more expensive version of SB4 is just SB4 bundled with one server pass, so just buy that one.

I keep getting this error: "An internal error occurred while trying to complete this request." SBAPI throws this error on several SB4 projects. I've tested it on my projects and on popular ones like Solid Gunner Vertika. Some work though, like Versus Buffalo.