S&box Wiki

Revision Difference

Backend_API#546719

<cat>Dev.Backend</cat> <warning>This API is prone to changes at any time - and therefore this guide might go out of date. If something doesn't line up, it probably means the API was changed and that this page needs updating.</warning> This page is an analysis of the API used for the [dev site](https://sbox.facepunch.com/dev/) and the in-game menus; please be aware that this may change at any time and that none of this information is official. All endpoints are on the `https://sap.facepunch.com/` domain. # Endpoints [Account endpoints](#accountendpoints) | [Asset endpoints](#assetendpoints) | [Session endpoints](#sessionendpoints) | [Other endpoints](#otherendpoints) # Account endpoints ## POST account/activity ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST account/login ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST account/services ### Params ### Returns ### Example Request ### Example Response ``` ``` # Asset endpoints ## GET /asset/{ident} ### Params `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. ### Returns An `Asset` ### Example Request [/asset/facepunch.construct](https://sap.facepunch.com/asset/facepunch.construct) ### Example Response ``` { "Asset": { "Org": { "Ident": "facepunch", "Title": "Facepunch", "Description": "", "Thumb": "https://files.facepunch.com/sbox/org/facepunch/logo.1.png", "SocialTwitter": "", "SocialWeb": "" }, "Ident": "pool", "Title": "Pool", "Summary": "A classic pub game where your skill is determined by your blood-alcohol content.\r\n", "Description": "A classic pub game where your skill is determined by your blood-alcohol content.\r\n", "Thumb": "https://files.facepunch.com/sbox/org/facepunch/pool/thumb.b52e5af8.jpg", "Background": "https://files.facepunch.com/sbox/org/facepunch/pool/background.21884981.jpg", "PackageType": 2, "Updated": 1619706156, "Download": { "Type": "github", "Url": "https://github.com/Facepunch/sbox-pool/tree/master" }, "ConfigJson": "{\"MinPlayers\":1,\"MaxPlayers\":2,\"NetworkType\":0,\"MapList\":[\"pool_lounge_v2\"],\"MapSelection\":1,\"RankType\":1,\"LeaderboardType\":1}", "UsersNow": 0, "UsersDay": 4, "UsersMonth": 55, "UsersTotal": 2191, "Tags": [ "!mousekeyboard", "multiplayer", "mousekeyboard" ], "CategoryId": 3, "SubCategoryId": 0, "Version": null, "Favourited": 65, "VotesUp": 87, "VotesDown": 2, "Source": "https://github.com/Facepunch/sbox-pool/tree/master" } } ``` --- ## GET /asset/list ### Params `type`: `map` or `gamemode`. `order`: `trending`, `popular`, `newest`, `live`. Defaults to `trending`. `search`: Any search query. `category` (An Index Value starting at 1): | Index | Category | |:-------:|:---------------------:| |1 | SandBox | |2 | Tech Demo/Expermental | |3 | Sports | |4 | Shooting | |5 | Parkour | |6 | Social | |7 | Meme | |8 | Roleplay | |9 | Racing | |10 | Mystery | |11 | Survival | |12 | Animals | |13 | Food | |14 | Strategy | |15 | Space | |16 | Fighting | |17 | Retro | |18 | Music | |19 | Art | |20 | Tycoon | |21 | Streamer | ### Returns A list of `Package`s. ### Example Request [/asset/list?type=map&order=trending&search=Construct](http://sap.facepunch.com/asset/list?type=map&order=trending&search=Construct) ### Example Response ``` [ { "Org": { "Ident": "facepunch", "Title": "Facepunch", "Thumb": "https://files.facepunch.com/sbox/org/facepunch/logo.1.png" }, "Ident": "construct", "Title": "Construct", "Summary": "A simple construct map", "Description": "This is the default map. It both has purpose and no purpose.", "Thumb": "https://files.facepunch.com/sbox/org/facepunch/construct/thumb.2f5f6e0a.jpg", "PackageType": 1, "Updated": 1643893793, "UsersNow": 0, "UsersDay": 134, "UsersMonth": 1580, "UsersTotal": 7774, "Tags": [], "CategoryId": 0, "SubCategoryId": 0, "Favourited": 0, "VotesUp": 0, "VotesDown": 0, "Source": null }, { "Org": { "Ident": "cstruct", "Title": "egg corporation's things", "Thumb": "" }, "Ident": "gm_construct", "Title": "gm construct", "Summary": "Bad port, but is working port!", "Description": "A bad port of gm_construct v13, that I am trying to get fixed-ish. I fully expect someone else to come along and do it better than I can, and if you have a problem with this version I encourage you to make your own. I'll give you all the files if you ask.\r\n\r\nVERSION HISTORY:\r\nV1 Release\r\nV1.1 Fixed some weird white sprites and also added some basic baked lighting(dark room now dark again)\r\nV1.1.1 Ladder for secret room works now. It's literally a stack of clipbrushes, basically very narrow invisible stairs, but that might unironically be better than Source 1 ladders, lmao\r\nV1.2 Added Long Description into map, this is now a \"cool release\" until I get the urge to work on it more. Contact me if it breaks, if you can.", "Thumb": "https://files.facepunch.com/sbox/org/cstruct/gm_construct/thumb.3464c8e.jpg", "PackageType": 1, "Updated": 1630804910, "UsersNow": 0, "UsersDay": 3, "UsersMonth": 102, "UsersTotal": 1458, "Tags": [], "CategoryId": 0, "SubCategoryId": 0, "Favourited": 0, "VotesUp": 0, "VotesDown": 0, "Source": null } ] ``` ## GET /asset/categories ### Params ### Returns A list of categories and tags. ### Example Request [/asset/categories](http://sap.facepunch.com/asset/categories) ### Example Response ``` { "Categories": [ { "Id": 0, "title": "None", "icon": "sentiment_dissatisfied", "description": null, "count": 7 }, { "Id": 18, "title": "Music", "icon": "music_note", "description": null, "count": 1 }, { "Id": 19, "title": "Art", "icon": "palette", "description": null, "count": 1 }, [...] ], "Tags": [ { "Count": 39, "Key": "multiplayer" }, { "Count": 7, "Key": "has:vsnd" }, { "Count": 8, "Key": "coop" }, [...] ] } ``` ## GET /asset/{ident}/leaderboard ### Params `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. ### Returns An `Leaderboard`. Query information, total number of entries and list of entries with `playerId, DisplayName, Rating` ### Example Request [/asset/facepunch.unicycle_frenzy/leaderboard](http://sap.facepunch.com/asset/facepunch.unicycle_frenzy/leaderboard) ### Example Response ``` { "Skip": 0, "Take": 20, "Count": 115, "PlayerPlace": null, "Entries": [ { "PlayerId": 76561197979190498, "DisplayName": "Crayz", "Rating": 0 }, { "PlayerId": 76561198068383694, "DisplayName": "Dopadream", "Rating": 0 }, { "PlayerId": 76561198169265681, "DisplayName": "JakeSayingWoosh", "Rating": 0 }, [...] ] } ``` ## GET /asset/{ident}/rank/{userid} ### Params `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. `userid`: An id for the user you wish to retrieve info about. ### Returns Game and Player rank information `Game` and player rank information ### Example Request [/asset/facepunch.unicycle_frenzy/rank/76561197979190498](http://sap.facepunch.com/asset/facepunch.unicycle_frenzy/rank/76561197979190498) ### Example Response ``` { "PlayerId": 76561197979190498, "PlayerName": "Crayz", "Game": { "Org": { "Ident": "facepunch", "Title": "Facepunch", "Thumb": "https://files.facepunch.com/sbox/org/facepunch/logo.1.png" }, "Ident": "unicycle_frenzy", "Title": "Unicycle Frenzy", "Summary": "Unicycle Frenzy challenges players to navigate through treacherous obstacle courses on a unicycle.", "Description": "Post feedback and issues here: https://github.com/Facepunch/sbox-unicycle-frenzy\r\n\r\nPress Tab in-game to see controls and customize your unicycle", "Thumb": "https://files.facepunch.com/sbox/org/facepunch/unicycle_frenzy/thumb.6a3718d.jpg", "PackageType": 2, "Updated": "2022-04-08T03:50:41.8+00:00", "Created": "2021-12-15T01:22:26.2+00:00", "UsersNow": 0, "UsersDay": 11, "UsersMonth": 181, "UsersTotal": 1218, "Tags": null, "CategoryId": 9, "SubCategoryId": 0, "Favourited": 55, "VotesUp": 62, "VotesDown": 8, "Source": "https://github.com/Facepunch/sbox-unicycle-frenzy", "Public": true }, "Level": 7, "Wins": 0, "Losses": 0, "Draws": 0, "Global": { "Value": "Global", "Position": 5 }, "Country": { "Value": "United States", "Position": 3 }, "State": { "Value": "Utah", "Position": 2 }, "City": { "Value": "Unknown", "Position": 5 }, "Diag": "225.13" } ``` ## GET /status ### Params ### Returns Staus information ### Example Request [/status](http://sap.facepunch.com/status) ### Example Response ``` { "Status": "OK", "Version": 1, "Assets": 3288, "Orgs": 3987, "Files": 99721, "FileSize": "337GB" } ``` ## POST account/activity ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST asset/{ident}/favourite ### Params `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. ### Returns ### Example Request ### Example Response ``` ``` ## POST account/login ## POST asset/Upload ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST asset/manifest ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST asset/{ident}/rate ### Params `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. ### Returns ### Example Request ### Example Response ``` ``` ## POST session/result ## POST asset/{ident}/update ### Params `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. ### Returns ### Example Request ### Example Response ``` ``` ## POST session/score # Session endpoints ## POST session/result ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST account/services ## POST session/score ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST asset/{ident}/update ### Params # Other endpoints ## GET /status `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. ### Returns Staus information ### Example Request [/status](http://sap.facepunch.com/status) ### Example Response ``` ``` ## POST asset/Upload ### Params ### Returns ### Example Request { "Status": "OK", "Version": 1, "Assets": 3288, "Orgs": 3987, "Files": 99721, "FileSize": "337GB" } ``` ### Example Response ``` ```