? SmileBASIC API ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Migrating to a new website for SmileBASIC 4

SmileBASIC API

April Fools!

April Fools came to SBAPI, and I got quite a few of you! I have not received any DMCA requests yet. Props to Na_trium for noticing my little easter egg (Tamake Shigatsu sent the DMCA, Tamake = Fool, Shigatsu/4-gatsu = April). The real service is back up and running. Thank you for continuing to use my service! I provide this service free of charge, and pay for the server to run it out of pocket. Donations to maintain the server and pay for my caffeinated beverages are not required, but appreciated. If you enjoy this service, want to help keep the server running, and have a bit of change, you can send me some money on PayPal. 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
26 votes
Categories
Keywords
  • sbapi
  • smilebasic
  • api
  • trinitro21
  • masterr3c0rd
  • brokenr3c0rd
  • file
  • format
  • png
  • grp
  • dat
  • txt
  • prj
  • projects
222 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 How are the Switch servers set up (how are they different from the SB3 servers)? 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 not the SmileBoom side, rather, it's the Nintendo side. They completely changed the way they handle logging into accounts, requiring a client certificate as far as I can tell (which is unique to every console). As such, it would be easy to ban the client and Switch. I'm hoping to figure out a way to get this working without having to fake a console (I contacted SmileBoom in the hopes to resolve this last year, and I've just sent them a new inquiry on their website, so I hope I'll hear back from them) 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 That’s an ouch. I guess Nintendo had a problem with SmileBoom hosting their own servers for downloading and uploading programs. Either that or it was too much money to run, which might mean that the SB3 servers are closing soon. 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 Smileboom still runs their own servers. For compliance with Nintendo online features and Nintendo Account authentication, they have to communicate with Nintendo before connecting to their own server. That's how the uploads are tied to your Nintendo Account. 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 Oh, my bad. I hope there’s a way we can get SBAPI working for SB4. I’m sure there’s a way. the_squat1115 the_squat1115 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 Wait, SBAPI will not work with SB4? ...ouch... 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 They're planning on making it compatible with SB4, They just haven't figured out how yet. hakke hakke RNG Hidden Easter Eggs QSP Contest 2 Contest Participant I participated in the second SmileBASIC Source QSP Contest! Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength I guess SBAPI for SB4 could use a generously donated modded Switch to access the servers, but that would be prone to bans... I don't know it's just a proof of concept. Midnight Midnight Deep Sleep Hidden Website that's like... amazing tbh 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 Can you add an encoding that allows projects to be downloaded with txts that have no metadata and GRPs that are converted to png? The reason why I'm asking is because I would like to use this with otyasmilebasic. 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 GRPs can be converted to PNG already.
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:
Also, TXT/PRG files can be opened in Wordpad and you can convert the program by simply saving it as a TXT file.
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 know, but you have to convert each one individually, which is annoying when downloading large projects. 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 work at adding this when I get the chance. 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 Added. You can add ?nice=1 to the end of the zip encoding URL, and it'll download it as a nicer ZIP file. Note that certain files (DAT files with > 2 dimensions) will stay raw. 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 Can you add an option to keep DATs raw? CSV DATs aren't compatible with otya. By the way, do raw DATs work well with PetitModem?
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 A question: How do I download a full game (with all the code and grps) to a computer? chicken chicken Admin http://sbapi.me/get/KEYHERE/zip 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 Suggestion: Add decompression support for .PKD format compressed files. 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 That's outside of the scope of what SBAPI should do. SBAPI is only meant to get files and convert them to file types that make sense, not to become a be-all end-all of SmileBASIC PC tools. That would be nice, but it would take forever and no one would really use it. 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 Okay, thanks for the response. Is there any documentation on how .PKD files are packed and how its compression methods could be ported to PC? 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 have absolutely no idea, you'd have to look at the unpacker and figure it out yourself. 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 want to note that we're still looking for people with SmileBASIC 4 and a hacked Switch to help with adding support for SB Switch keys on SBAPI. If you have what's needed and you're interested, please DM on Discord (@MasterR3C0RD#7695), send me a Site PM, or message me in the SBS Chat. TheV360 TheV360 Pokemon Is Awesome! I love Pokemon! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself Bug: Seems like some of the metadata disappeared. This is only when I use the zip option. When I download keys that only contain one file (not even a folder) the metadata is intact. 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 because SB removes file metadata when it makes a project. I'll have this fixed ASAP 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 I love it. Without it, I wouldn't be able to transfer my programs to my tablet because I don't have any PC any time soon.Okay, I could write out each byte one at a time and on GRPs one pixel at a time but typing it in using no actual keyboard is horrible if not, it would take years to even get my projects on my device, when it doesn't fail... 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 How do I transfer binary and GRP files back to my 3DS via PetitModem? Is the file structure different, or is it the same as sending a DAT/GRP file to PC via PetitModem? 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 What time zone is used for the upload times in the SiteJS version? 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 The timezone of whoever uploaded the files 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 k 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 For anyone using the SiteJS, if you want to use MB (megabytes) and KB (kilobytes) instead, change the 1024 values to 1000, and rename the MiB value to MB. 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 Also, the K should technically be lowercase. 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 Eh, I personally left it the same because I’m used to having it uppercase (other devices use capital K). But a lowercase K is the correct way. the_squat1115 the_squat1115 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 Lol, that is a mature theme 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 Use the reply button, please. You probably can’t see it right now, so head to your settings page, and disable the checkmark for hiding options on comments. You should be able to reply to comments now. 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 Also what 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 He looked at the meme I posted in a reply 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 Oh lol the_squat1115 the_squat1115 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 Oh 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 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 This is very useful thanks for submitting this the_squat1115 the_squat1115 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 But I cant get it... 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 2 things, 1 congrats on using the reply button, and second of all, you need a pc or a laptop or some sort of computer to use it the_squat1115 the_squat1115 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 Oh, ok 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 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 click the reply button on comments the_squat1115 the_squat1115 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 The key of 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 It doesn’t work on a key the_squat1115 the_squat1115 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 And where's the key? TheV360 TheV360 Pokemon Is Awesome! I love Pokemon! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself Hover or tap your previous comment and a reply button will appear. You can use that to clean up chains of comments so people don't have to read them backwards. Also note that there is an edit button, to correct mistakes and clarify details. the_squat1115 the_squat1115 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 I was talking about without a PC the_squat1115 the_squat1115 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 In that API, is there a Wav to SB Wav converter? 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 think you mean the other way around, but just use Perska’s tool if you want to convert WAVs to SB WAVs. 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 is really cool! Using this tool, it would be 10x easier to archive the SmileBASIC servers in case they go down.
1 2 3 4