API Endpoints
View all of our API endpoints, learn about our data structuring, and integrate your framework with Sonoran CMS.
Looking for VPS, web, or dedicated hosting? Check out our official server hosting!
Sonoran JS - NPM Library
Sonoran CMS offers a complete Node API library from NPM!
npm i @sonoransoftware/sonoran.js
Learn more about our NPM library!
Available API Endpoints
General Endpoints
View all general endpoints for user account actions, administrative actions, and more!
GeneralServer Endpoints
View all server endpoints for game server whitelist, server management, etc.
ServersServer Endpoints
View all event endpoints for calendar events!
EventsAPI Code Examples
Javascript
This example makes a get community account request based on a given API ID (Discord ID here). This uses the Axios library to help make the HTTP POST request.
The server response is then logged to console.
// Import Axios library
// https://www.npmjs.com/package/axios
// Install command: `npm i axios`
import axios from 'axios';
// Set the API URL (CMS backend)
let baseURL = 'https://api.sonorancms.com';
// Set the `api` object to be used
let api = axios.create({ baseURL });
// Format the POST body data
// https://info.sonorancms.com/developer-api-documentation/api-integration/api-endpoints/general/get-com-account
const data = {
id: 'YOUR_COMMUNITY_ID',
key: 'YOUR_API_KEY',
type: 'GET_COM_ACCOUNT',
data: [
{
apiId: "235947056630333440" // Discord ID
}
],
};
// Send the POST request
// Format the data to JSON
api.post('/general/get_com_account', JSON.stringify(data))
.then((response) => {
// Response back from the backend
console.log(response);
})
.catch((err) => {
// Error response back from the backend
console.log(err);
});
Lua
This example makes a get community account request based on a given API ID (Discord ID here). This uses the FiveM performHttpRequest native to help make the HTTP POST request.
The server response is then logged to console.
-- Body payload object
local payload = {}
-- Specify our community ID, API key, and API method type (Panic)
payload["id"] = "YOUR_COMMUNITY_ID"
payload["key"] = "YOUR_API_KEY"
payload["type"] = "GET_COM_ACCOUNT"
-- Data: List (array) of unit panic objects
-- Here, we're specifying one unit to PANIC
local postData = {
{
["apiId"] = "235947056630333440", -- Discord ID
},
}
-- Add this data to our payload
payload["data"] = postData
-- Send POST request with JSON encoded body (payload)
PerformHttpRequest("https://api.sonorancms.com/general/get_com_account", function(statusCode, res, headers)
if statusCode == 200 and res ~= nil then
-- Status code 200 (Success)
print("result: "..tostring(res))
else
-- Error code
print(("CMS API ERROR: %s %s"):format(statusCode, res))
end
end, "POST", json.encode(payload), {["Content-Type"]="application/json"})
Endpoints Subscription Requirements
Each endpoint requires a certain subscription, some may be available for communities on the Free plan or some may require the Pro plan, the table below shows what subscription is required per endpoint.
/general/get_sub_version
/general/check_com_apiid
/general/get_com_account
/general/get_account_ranks
/general/clock_in_out
/servers/get_game_servers
/servers/verify_whitelist
/servers/full_whitelist
Last updated
Was this helpful?