S&box Wiki

Revision Difference

Backend_API#546835

<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": "Facepunch Studios Ltd is a British video game developer and publisher headquartered in Walsall, England, founded in June 2004", "Thumb": "https://files.facepunch.com/sbox/org/facepunch/logo.1.png", "SocialTwitter": "", "SocialWeb": "" }, "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", "Background": "https://files.facepunch.com/sbox/org/facepunch/construct/background.2d7794af.jpg", "PackageType": 1, "Updated": "2022-03-31T10:43:21.7+00:00", "Created": "2021-05-10T10:21:44.2+00:00", "UsersNow": 0, "UsersDay": 123, "UsersMonth": 1366, "UsersTotal": 7812, "Tags": [], "CategoryId": 0, "SubCategoryId": 0, "Version": { "FileCount": 1403, "TotalSize": 2377116895, "AssetVersionId": 2411, "Created": "2022-03-31T10:43:21.3+00:00", "Manifest": "[...]", "EngineVersion": 2, "Meta": null }, "Favourited": 0, "VotesUp": 0, "VotesDown": 0, "Source": null, "Public": true }, "QueryTime": 99.8013 } ``` --- ## GET /asset/list ### Params `type`: `map` or `gamemode`. `type`: `map`, `gamemode`, `tool`, `content`, `model`. `order`: `trending`, `popular`, `newest`, `live`. Defaults to `trending`. `search`: Any search query. `take`: Number of assets to return `skip`: Offsets the number of assets to take `take`: Number of assets to return. `skip`: Offsets the number of assets to take. `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": "2022-03-31T10:43:21.7+00:00", "Created": "2021-05-10T10:21:44.2+00:00", "UsersNow": 0, "UsersDay": 123, "UsersMonth": 1366, "UsersTotal": 7812, "Tags": [], "CategoryId": 0, "SubCategoryId": 0, "Favourited": 0, "VotesUp": 0, "VotesDown": 0, "Source": null, "Public": true }, { "Org": { "Ident": "gmodn", "Title": "Ian", "Thumb": "https://files.facepunch.com/sbox/org/gmodn/logo.8483162e.png" }, "Ident": "testmap", "Title": "Ian's Construct", "Summary": "A map i used to kinda get used to mapping again. Not a good map.", "Description": "A map i used to kinda get used to mapping again. Not a good map.\r\n\r\nUpdate Log\r\n\r\n1/9/2022\r\nAdded Map\r\nAdded shatterglass where possible\r\nadjusted lighting\r\nmade the original dark/light room building from construct rp friendly \r\nAdded Warehouse Overhang Lights\r\n\r\n2/21/2022\r\nAdded world maps\r\nAdded Navmesh\r\nAdded Map overview", "Thumb": "", "PackageType": 1, "Updated": "2022-03-26T05:44:02.6+00:00", "Created": "2022-01-09T13:03:07+00:00", "UsersNow": 0, "UsersDay": 0, "UsersMonth": 3, "UsersTotal": 15, "Tags": [], "CategoryId": 0, "SubCategoryId": 0, "Favourited": 0, "VotesUp": 0, "VotesDown": 0, "Source": null, "Public": true }, ] ``` ## 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 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 ### 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" } ``` ## 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 /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 /asset/{ident}/update ### Params `ident`: An identifier (`org`.`package`) for the asset you wish to retrieve info about. ### Returns ### Example Request ### Example Response ``` ``` # Session endpoints ## POST /session/result ### Params ### Returns ### Example Request ### Example Response ``` ``` ## POST /session/score ### Params ### Returns ### Example Request ### Example Response ``` ``` # Other endpoints ## GET /status ### 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" } ```