Determining the URL for an interface

Occasionally you need to determine the domain name for an interface in RightNow CX. There are many ways in which we can retrieve the interface names (using an OptList in the Add-In Framework, or the getValuesForNamedID() method in the SOAP or PHP Connect APIs). And from the interface name you can typically determine the domain name.

For instance, if your interface name is "foo_bar", your domain name would be "". Note that certain characters (such as an underscore) are translated to a dash in the domain name. You will need to build this logic into your application. I don't know all of the rules, but likely any character outside of a-z & 0-9 should be replaced with a dash.

This is fine unless the interface is using a vanity URL (custom CNAME), such as "". However, you can still get the vanity URL for the interface. This article will show you how.

RightNow does create DNS entries for a sub-domain for all interfaces, even those with a vanity URL. When an interface has a vanity URL, any request to the sub-domain will automatically be redirected with an HTTP 301 response. Here is an example of what this looks like using the cURL command line utility:

user@host]$ curl -v
* About to connect() to port 80 (#0)
*   Trying
* connected
* Connected to ( port 80 (#0)
> GET /cgi-bin/foo_bar.cfg/services/soap?wsdl=typed HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host:
> Accept: */*
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 23 May 2014 23:43:37 GMT
< Server: Apache
< Location:
< Vary: Accept-Encoding
< Content-Length: 276
< Content-Type: text/html; charset=iso-8859-1
<title>301 Moved Permanently</title>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="">here</a>.</p>
* Connection #0 to host left intact
* Closing connection #0

Note that I changed the interface name and domain name in the output above. The hostname is not valid as far as I know.

Notice how the response headers include the 301 status code: "HTTP/1.1 301 Moved Permanently" and the redirect to the vanity URL: "Location:"

So, if you have the interface name you can transform it into the sub-domain, and then make a request to that new domain. Capture the HTTP response headers and from those headers you can determine if there is a vanity URL (if it returns an HTTP 301 status code) and if so, what the vanity URL/domain is (from the Location response header).

Categories : 

Zircon - This is a contributing Drupal Theme
Design by WeebPal.