Create Short URL

Create a short URL for the community.

POST https://api.sonorancms.com/v2/community/short-urls

Rate limit: 13 requests per minute

Authenticated v2 endpoints are rate limited per credential rather than per IP address.

Create a short URL for the community.

Request Body

| Name | Type | Required | Description |

| --- | --- | --- | --- |

| path | string | Yes | See example request for the shape. |

| isCustomDomain | boolean | Yes | See example request for the shape. |

Example Request

local Sonoran = require("sonoran")

local sonoran = Sonoran.createClient({
  product = Sonoran.productEnums.CMS,
  apiKey = "YOUR_API_KEY",
  communityId = "YOUR_COMMUNITY_ID",
  defaultServerId = 1,
  timeoutMs = 30000,
})

local payload = {
  ["path"] = "/go/example",
  ["isCustomDomain"] = false
}

local response = sonoran.cms:createShortUrlV2(payload)

if response.success then
  print(response.data)
else
  print(response.reason)
end

Response

The data object is the nested short-url lookup result. On success it contains success: true and the resolved redirect URL.

Last updated

Was this helpful?