prim-dns is a permanent, customizable SecondLife prim URL webservice.
Scripts in SecondLife can request URLs via llRequestURL
or llRequestSecureURL
, which allow them to receive and respond to HTTP requests from other scripts or even from outside of SecondLife. However, these URLs are temporary, and scripts need to request new URLs periodically, for example when the region the script is in restarts. prim-dns allows a prim to create a permanent URL which points to the temporary one, and then update it whenever it receives a new temporary URL. Other entities can use this permanent URL to obtain the current temporary one at any given time.
The prim-dns-server project provides a script which handles automatically obtaining a URL for a prim and registering it on the prim-dns webservice, and forwards requests to additional scripts via link messages to handle them. The API documentation below is only needed if you wish to create your own script from scratch or interact with the API via some other method.
Create or update an alias for a SecondLife prim URL. A prim should make this request whenever it receives a new URL, such as when the script is restarted, the prim changes regions, or the region the prim is in restarts.
X-SecondLife-Object-Key
The key of the requesting prim, used as the name of the alias if no custom name is provided.Authorization
The auth string is required to update an existing alias, but may be omitted when creating a new alias.
name
A custom name for the alias. If omitted, the requesting prim's key (from theX-SecondLife-Object-Key
header) is used as the name.url
The SecondLife prim URL that the alias is for.
name
The name of the created alias.auth
The auth string that should be used in theAuthorization
header in order to update or delete the alias.endpoint
The full endpoint URL for the alias.redirect
A URL that can be used to send requests directly to the prim.Note: This cannot be used by scripts to make
POST
requests to the prim, asllHTTPRequest
does not handle redirects forPOST
requests transparently.
llHTTPRequest("https://annapuddles.com/prim-dns/alias", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/json"], llList2Json(JSON_OBJECT, ["name", "example", "url", "https://google.com"]));
{
"name": "example",
"auth": "0ba171f25c8e8f8fd60dc58781239faf03ffe260",
"endpoint": "https://annapuddles.com/prim-dns/alias/example",
"redirect": "https://annapuddles.com/prim-dns/redirect/example"
}
llHTTPRequest("https://annapuddles.com/prim-dns/alias", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/json", HTTP_CUSTOM_HEADER, "Authorization", "0ba171f25c8e8f8fd60dc58781239faf03ffe260"], llList2Json(JSON_OBJECT, ["name", "example", "url", "https://google.com"]));
{
"name": "example",
"endpoint": "https://annapuddles.com/prim-dns/alias/example",
"redirect": "https://annapuddles.com/prim-dns/redirect/example"
}
Get the current SecondLife prim URL for an alias.
url
The prim URL that the alias is for.expires
The date and time at which the alias will expire if it has not been accessed again.
llHTTPRequest("https://annapuddles.com/prim-dns/alias/example", [], "");
{
"url": "https://google.com",
"expires": "2023-02-08 16:40:43"
}
Delete an existing alias.
Authorization
The auth string for the alias.
llHTTPRequest("https://annapuddles.com/prim-dns/alias/example", [HTTP_METHOD, "DELETE", HTTP_CUSTOM_HEADER, "Authorization", "0ba171f25c8e8f8fd60dc58781239faf03ffe260"], "");