Skip to main content

Deleting a region targeting rule

📘 Information below might be outdated - please visit our recently updated API Reference

The instruction below shows how to delete a region targeting rule for a link.

1) Get your API key here: https://app.short.io/settings/integrations/api-key​

  • Click "Create API key".
  • Add a Secret key.

  • Open the statistics of the short link.
  • Copy the link ID.

3) Install prerequisites for requests.​

pip install requests

Now everything is ready to run the following snippet. It will delete a region targeting rule.

4) Create a file: filename.py/ .js/ .rb. Use the code snippet below.​

📘

Please, replace link_idString and ISO country code, ISO region code with appropriate values.

You need to specify country ISO code and country region code in ISO-3166-2 format. Example: US (country) - United States; NY (region) - New York. You can find a necessary ISO code here: http://www.geonames.org

import requests

url = "https://api.short.io/link_region/link_idString/DZ/07"

headers = {'authorization': '<<apiKey>>'}

response = requests.request("DELETE", url, headers=headers)

print(response.text)

5) Launch the file.​

python filename.py

6) JSON Response (a region targeting rule is removed).​

Once you run the code, you will see the response.

{
success: true
}