? SmileBASIC API ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Tell us how you'd like SBS to move forward: New SBS Status

SmileBASIC API

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:

  1. 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!
  2. 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!
  3. 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!
  4. 02/04/2020: WebSocket query API implemented! Read more details below.
  5. 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:
  1. 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)
  2. list - only projects, lists all files (use ?json=1 if you're writing a program to get information as JSON)
  3. 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
  4. raw - all files, downloads the raw file.
  5. text - only TXTs, returns the text content of the file
  6. code - only TXTs, highlights code using 12Me21's SBHighlight library (use ?wrap=1 to enable word-wrapping)
  7. png - only GRPs, converts the GRP to a PNG
  8. json - only DATs, returns the DAT information as a JSON array of arrays.
  9. csv - only 2D DATs, converts the data to a CSV (comma-separated values) file
  10. icon - only META files, returns the icon as a PNG file.
  11. 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)
  12. 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
  1. 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
  2. MasterR3C0RD - hosting, wrote the server communication libraries and helped with reverse engineering of SmileBASIC's servers
  3. 12Me21 - wrote sbhighlight and rewrote the SiteJS plugin to work with more browsers
  4. snail_ - working on proper documentation for API
  5. Yttria - word of reason, helped with multiple things internally
  6. Jaku - helped with SB4 support
Author
MasterR3C0RD
Updated
Rating
27 votes
Categories
Keywords
  • sbapi
  • smilebasic
  • api
  • trinitro21
  • masterr3c0rd
  • brokenr3c0rd
  • file
  • format
  • png
  • grp
  • dat
  • txt
  • prj
  • projects
225 Comment(s) HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength You should remove the April Fools message at the top of the page, it's been there for a while. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Just in case people start freaking out, I'm migrating SBAPI to a dedicated server for improved performance. It'll be back before you know it. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself It's back up! rando rando Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Avatar Taboo I didn't change my avatar for 180 days Website So SBAPI seems kind of unsure whether or not Wonderflonium is available. When I checked just barely, it thought that Wonderflonium wasn't available, even though when I checked it was. And the last time I reported it thinking that Wonderflonium was unavailable, I went back and checked and it changed it's mind. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Nah, it's a bug with the way I'm generating 3DS tokens. Give me a few minutes, getting the fly swatter out MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself :crab: BUG IS DEAD :crab: rando rando Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Avatar Taboo I didn't change my avatar for 180 days Website Ok cool Na_trium Na_trium The uploaded date is broken... rando rando Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Avatar Taboo I didn't change my avatar for 180 days Website SBAPI thinks that Wonderflonium isn’t available even though it is. It’s causing the page on the new website to break. EDIT: It works now. I wonder what was going on. RGamesOffical RGamesOffical Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Minecraft Is Awesome! I love Minecraft! Express Yourself Video Games I like to play video games! Hobbies I'm getting an error (An internal error occurred while trying to complete this request.) when using /get/.../downloads. cypherpunks cypherpunks how do i download programs to my 3ds with smilebasic api photonegativemickey photonegativemickey Minecraft Is Awesome! I love Minecraft! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies what. HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Uhh SBAPI just caches projects from SmileBoom's servers. It doesn't host anything else. niconii niconii Power User Video Games I like to play video games! Hobbies Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Drawing I like to draw! Hobbies You don't need SBAPI if you have a 3DS, you can just download them with SmileBASIC. The point of SBAPI is to access projects without a 3DS. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself As nico said, the point of SBAPI is that you don't need your 3DS to access things uploaded to the SmileBASIC Servers. However, it does allow access to download files, so you could download the raw files from SBAPI and copy them over with SBFM. Na_trium Na_trium The sender of this mail is Tawake Shigatsu... Tawake(戯け) means fool, and Shigatsu(4月) means April... And the date is April 1st... Is this the real request from Nintendo? photonegativemickey photonegativemickey Minecraft Is Awesome! I love Minecraft! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Big Brain! I knew something was up when it was taken down. ON APRIL FOOLS DAY. Na_trium Na_trium I also searched the zip code 491-1101 and the phone number (+81)051-270-1860, and I found they don't exist. photonegativemickey photonegativemickey Minecraft Is Awesome! I love Minecraft! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies confirmed april fools day prank? HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength LMAO I can't believe I fell for this I should've known something was up when Record left most of the documentation on the page. thou_fatGAMER12 thou_fatGAMER12 Video Games I like to play video games! Hobbies Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Damn I actually fell for this Good April Fools the_squat1115 the_squat1115 First Year My account is over 1 year old Website Forum Contributor Hidden Achievements Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength What happened? Any April Fools joke? Na_trium Na_trium I was very surprised because SBAPI was taken down just when I was using it. the fake request: HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength This fucking sucks. SBAPI had a lot of potential, but of course copyright laws have to shit on everything. I feel really sorry for you Record, and everyone else who's worked really hard on this. photonegativemickey photonegativemickey Minecraft Is Awesome! I love Minecraft! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies U may have gotten fooled. HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength I did Chatter Chatter This news is so shitty. I feel so bad for you, trinitro, and everyone else who spent countless hours reverse-engineering the SmileBASIC file format and servers, just for this to happen. Will the already-present programs still be available? MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself There was a long email chain and multiple phone calls about that very subject. I was told that since I had gotten the files by unauthorized use of their private APIs, that I would have to delete everything. This was honestly the worst part of this entire experience. The whole point of SBAPI was to provide a useful service while caching every program on SmileBASIC in case the official servers were taken down at some point. That goal has been completely ruined. Chatter Chatter You got me good. Good job. Na_trium Na_trium http://sbapi.me/get/444EDZEQD/TORIGINAL.OHD/downloads It says "undefined downloads" MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself downloads should not be used on a file, only the actual key. That doesn't matter now though. Tarudahat Tarudahat QSP Contest 2 Contest Participant I participated in the second SmileBASIC Source QSP Contest! OSP Contest 3 Contest Participant I participated in the third SmileBASIC Source OSP Contest! Avatar Taboo I didn't change my avatar for 180 days Website I found a bug in Sbapi. For some SB3 programs (sb4 prog. don't seem to have this.) the download count is 0 eventough it has been downloaded multiple times example https://sbapi.me/get/QRNPX3V3/info, https://sbapi.me/get/PE33D2AE/info, https://sbapi.me/get/WR3XX3RJ/info, https://sbapi.me/get/5374EW4E/info... Spooky maze and maybe some others (I didn't check that many proj except these and some others) do have a correct download amount. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself AHHH I know the issue. I forgot to update download count :( MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Fixed! Please remember to keep sending me these bugs :) snail_ snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements I've gone key crazy! SBAPI has now cached over 2000 keys! the_squat1115 the_squat1115 First Year My account is over 1 year old Website Forum Contributor Hidden Achievements Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Wow Na_trium Na_trium http://sbapi.me/get/4483DEF/T--NEW_OMOCHI/info It says "An internal error occurred while trying to complete this request." and I can't get information. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Fixed. Thanks for reporting! HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength SBapi seems to have been down since this morning. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Fixed, just had to restart the server the_squat1115 the_squat1115 First Year My account is over 1 year old Website Forum Contributor Hidden Achievements Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength SBAPI is broken again... HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength It's working fine for me. Are you using the latest SiteJS? Yolkai Yolkai Head Admin (it was resolved quietly between the time of these two posts) HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength エスバピ Esbapi MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Es uh bah pee It's the official pronunciation for SBAPI You're welcome :) HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Wait, that's how it's pronounced? I always thought it was pronounced by letter, S-B-A-P-I. Good to know. rando rando Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Avatar Taboo I didn't change my avatar for 180 days Website I thought it would be es ba pee not es uh bah pee MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself The uh is just a remanent if you're saying it in proper Japanese. The actual English pronunciation IS ess-bah-pee. Sorry for the confusion Na_trium Na_trium I think エスバピ is pronounced like Es-sue-bah-pee in Japanese MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself You're right... it's been a while since I reviewed my katakana pronunciations... That's what I meant to say in the very beginning, thanks for the call out lol rando rando Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Avatar Taboo I didn't change my avatar for 180 days Website Cool CyberYoshi64 CyberYoshi64 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Night Person I like the quiet night and sleep late. Express Yourself There's a weird bug relating the SiteJS: I was opening atmOS's SB page and SBAPI was trying to get info for key 4J5XA3 but the actual key is 433J5XA3. SBAPI using the actual site .../get/433J5XA3/info works fine. Is it cuz the 4 accidentally signifies it being a SB4 key and therefore the 3s being omitted as it thinks that's the start of the key? (my speculation). I might and perhaps will be wrong here though. 12Me21 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself var keyregex = /\b(4?)3*([A-HJ-NP-TV-Z1-9]{1,8})\b/g; this is supposed to strip leading 3s but it thought the key was for sb4 since it starts with 4, CyberYoshi64 CyberYoshi64 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Night Person I like the quiet night and sleep late. Express Yourself Oh cool, my speculation is right for the first time in my life. lol This was also my first bugreport to that weird scripting language, Python JavaScript. Okay, that mismatch was a bad joke MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself I kinda gave up trying to trim SB4 keys server side, it's impossible enough that I have decided not to bother with it. I'll fix the bug though, give me a few MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Alright, here's the fix. I ended up a tad busy so I couldn't get the change done as soon as I thought I would be able to. If you don't have the SiteJS installed yet, the latest version installed fixes this problem. If you already have it installed, there's no need to change everything. Replace var keyregex = /\b(4?)3*([A-HJ-NP-TV-Z1-9]{1,8})\b/g; with var keyregex = /\b(4|3*)([A-HJ-NP-TV-Z1-9]{1,8})\b/g; Save and reload and you're all set! CyberYoshi64 CyberYoshi64 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Night Person I like the quiet night and sleep late. Express Yourself Well, unless you're lazy enough to make a loader with document.appendChild like I did, lol Midnight Midnight Deep Sleep Hidden Website S Bapi Ess Boppy KunaitoSoft KunaitoSoft Forum Contributor Hidden Achievements Avatar Taboo I didn't change my avatar for 180 days Website First Year My account is over 1 year old Website Here's what the S Bapi reminded me of: Suh-boppie 12Me21 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself I designed the logo (record when are you adding that to the credits lol) IAmRalsei IAmRalsei Forum Leader Hidden Achievements Second Year My account is over 2 years old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength never that logo is awful and will probably be replaced one day also Ess Bappy Yolkai Yolkai Head Admin bold words from someone that didn't realize that's the joke MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself S Bapi Will never be replaced. But I won't give 12 credit, I'm not into negotiating with terrorists HTV04 HTV04 Forum Leader Hidden Achievements Third Year My account is over 3 years old Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength 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. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself I'll have to take a look. MasterR3C0RD MasterR3C0RD Power User Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Restarting SBAPI fixed the problem, it seems to be an issue with updating tokens. I've added more debugging so I'll see when the problem pops up again but that shouldn't be for another few hours. The reason some games worked and others didn't was because of caching. EDIT: I fixed the issue. It was as simple as changing an < to an > lol 1 2 3 4