Documentation
    Amazon Web Services
    Microsoft Azure
    RapidAPI
    APILayer
Last Update: 2024-04-16

azr.link URL Shortener


Table of Content


Subscribe on Azure Marketplace
Code samples
API endpoint: Shorten
API endpoint: Remove
API endpoint: Tracking
Custom Domain Integration
Troubleshooting

Subscribe at Azure Marketplace


Visit our listings page on the Azure Marketplace and click on 'Get It Now'.

In the Azure portal, choose a plan depending on whether you wish to implement your own custom domain, then click on 'Subscribe'.

Select a resource group, give the subscription an internal name, and click on 'Review + subscribe'.

Click on 'Subscribe' to finalize your subscription.

Begin creating your account on our platform by clicking on 'Configure account now'.

You will be directed to the registration page. Here, fill in your account details in the provided fields. After entering all necessary information, click on 'Subscribe' to proceed.

Upon successful registration, your unique API key will be displayed. It is crucial to store this key in a secure location for future use.

Code samples


The following code samples creates a short URL with a random key. The link will expire after 24 hours. Replace <YourApiKey> with the actual API Key you received during the sign-up process:

var client = new RestClient("https://api.azr.link/shorten");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Ocp-Apim-Subscription-Key", "<YourApiKey>");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"  ""longUrl"": ""https://www.silverlining.cloud/docs/azure/azr-link""," + "\n" +
@"  ""expireHours"": 24" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
API endpoint: Shorten


URL endpoint: https://api.azr.link/shorten


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}


"body": {
  "longUrl": STRING,
  "customKey": STRING,
  "expireHours": NUMBER,
  "keyLength": NUMBER,
  "customDomain": STRING
}



Required

"longUrl": The destination URL to which you want to redirect. The protocol (e.g., http, https) must be included. The maximum supported length is 2000 characters.

 
Optional

"customKey": Define a custom key ("aws3.link/customKey"). If no customKey is provided, a random string will be generated as the key.

 "expireHours": Define the number of hours until the shortened URL expires. Must be between 1 and 8760 (= 1 year). Default is 0, which means a non-expiring link.

"keyLength": This parameter allows you to define the length of the randomly generated key. It can be set to any value between 4 and 8. If not specified, the default length is set to 6 characters.

"customDomain": Pass the domain name you want to use for shortening your URL. Before using this, please refer to the 'Custom domain integration' section below. Public-facing domains that can be added without any additional charge include: aws3.link, goog.link, docn.link, and an.si.

Response:


"body": {
  "shortUrl": STRING,
  "metadata": {
    "longUrl": STRING,
    "domain": STRING,
    "key": STRING,
    "expiration": DATE,
  }
}
API endpoint: Remove


URL endpoint: https://api.azr.link/remove


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}


"body": {
  "key": STRING,
  "customDomain": STRING
}


Required
 
"key": The key of the short URL you want to delete. For example, 'myKey' for azr.link/myKey.

Optional

"customDomain": If you are using a custom domain, specify the domain to which the provided key belongs.


Response:


"body": {
  "message": "Provided key has been removed",
  "metadata": {
    "longUrl": STRING,
    "domain": STRING,
    "key": STRING
  }
}

API endpoint: Tracking


URL endpoint: https://api.azr.link/tracking


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}


"body": {
  "key": STRING,
  "customDomain": STRING
}

Required 
"key": The key of the short URL you want to track, such as 'myKey' for azr.link/myKey.

Optional

"customDomain": If you are using a custom domain, specify the domain to which the provided key belongs.

Response:


"body": {
  "totalHits": NUMBER,
  "hits": [{
    "date": DATE,
    "time": TIME,
    "ip": STRING,
    "method": STRING,
    "resource": STRING,
    "referrer": STRING,
    "user": {
      "platform": {
        "name": STRING,
        "version": STRING,
      },
      "os": {
        "name": STRING,
      },
      "bot": BOOLEAN,
      "flavour": {
        "name": STRING,
        "version": STRING,
      },
      "browser": {
        "name": STRING,
        "version": STRING
      }
    },
    "rawUserAgent": STRING,
    "timeTaken": FLOAT
  }],
  "metadata": {
    "longUrl": STRING,
    "domain": STRING,
    "key": STRING
  }
}

"totalHits": Number of successfully registered clicks.

"hits: List of actual clicks, including the date and time the URL was clicked, IP address, referring URL, and detailed information about the user's device.

"metadata": Long URL, (custom) domain, and key of the request.

Custom Domain Integration


Enhance your URL shortening experience by utilizing your own domain, offering a personalized and branded approach. To ensure a seamless integration, please follow these steps:

Subscription Requirement: Make sure you are enrolled in a subscription that includes custom domain integration.

DNS Configuration: After your subscription is confirmed, we will contact you via email with the necessary DNS records. It is crucial to add these records to your domain's DNS settings. This step is essential for linking your domain with our URL shortener and for validating an SSL certificate to secure HTTPS traffic.

API Endpoint Usage: Once your domain is configured, you can make API calls to our /shorten, /remove, and /track endpoints using the customDomain parameter. This allows for seamless operations with your own domain.

Important Note: The responsibility for purchasing and maintaining the domain lies solely with the customer. Ensure your domain is active and properly configured to avoid any disruptions to the service.

By adhering to these steps, you can elevate your URL shortening service with a custom domain, creating a more branded and professional presence for your short links. If you encounter any issues or have questions during the setup process, our support team is ready to assist you.

Troubleshooting

"message": "Invalid Input: The request contains incorrectly formatted parameters"

This error message means that the body parameters you have passed are malformed. Please follow the instructions given in the endpoint descriptions. Common issues include forgetting to add a comma (',') after every parameter line or missing a parenthesis somewhere.

Batch Import of Shortened URLs

If you are currently using another URL shortening service and wish to import your existing shortened URLs to our platform, we offer support for batch imports. Please contact us at support@silverlining.cloud, and one of our engineers will assist you throughout the process.

Setting Up CNAME or A Record for the Apex of a Domain

When integrating your base domain (e.g., example.com) with our service, you may need to set a CNAME or A record to redirect to a URL at the apex of the domain. This step is not necessary if you only intend to integrate a subdomain (e.g., link.example.com) with our service.

Most domain registries (such as GoDaddy) do not allow setting a URL as the destination for the apex of a domain. However, there are workarounds to address this issue. We recommend using AWS Route 53, a DNS hosting service that allows you to configure the records as required by our setup. It offers a way to keep your domain registered with your current registry while managing the DNS through AWS. For guidance on integrating AWS Route 53 with your domain, please refer to this blog post: https://jryancanty.medium.com/domain-by-godaddy-dns-by-route53-fc7acf2f5580.

Alternatively, you can set up a redirection to our backend for the "www" subdomain and then redirect from the apex domain to the "www" subdomain. This approach can be implemented using a service like http://wwwizer.com.