API Calls
url
urls
file
file_part_initialize
file_part_upload
file_part_finalize
change_shorturl
set_enabled
set_tag
set_expiration_count
delete
get_entry
get_entries
get_protected_file_info
get_signature
temporary_account
signup
login
logout
change_password
check_credentials
forgot_password
reset_password
verify_email
get_account_info
multi

url

POST /v2/url

Shortens a given url. If 'host' is not given, the default is 'ww7.io' which produces https://ww7.io/123456. If 'code' is provided (it is the '123456' part of the shortened url) and it belongs to the user, this call functions as 'replace' and replaces the old entry for the given code.

Weight: 1000 per call


INPUT ITEMS

userid     str[32] - required

User ID identifying the user. This can be created with signup or temporary_account API calls, or can be reached via login API call for an existing registered account.


token     str[32] - required if userid is registered

Proof of credentials for a registered account. The token can be created with login API call. The validity duration depends on the account type; verified/registered/temporary.


url     str - required

The full URL to be shortened. Example: 'https://www.example.com/a_very_lonh_url.html'


expiration_utime     int64 - optional (default: 576460752303423487)

Expiration time given in unix-time in microseconds. Default is 0x7ffffffffffffff.


tag     int64 - optional (default: 0)

Each bit defines a logical tag. This tag can be used as filter for get_entries.


expiration_count     int - optional (default: 0)

Short URL expires after this many number of clicks. Setting 0 disables the click-count-expiration.


host     str - optional (default: ww7.io)

Requested base host of shortened url. The available hosts are: ww7.io


code     str - optional

Provided to replace an existing shortened url or to use it if it does not belong to another used. Must be [6,16] in length, and contains only 26 letters in small and caps, and numbers.


shorturl     str - optional

Shortened url to be used. Ex: https://ww7.io/sD4fSa. If this parameter is provided, host and code parameters will be ignored.


qr     dict - optional

If provided, entry output returns 'qrcode' containing an image of the QR code of shortened link. The dictionary can have the following keys describing the format:

        format : Can be 'svg' or 'png'. Default: 'svg'
        border : Border around the QR code in background color. Default: 3
        fg : Foreground color. Default: '#000000' (black)
        bg : Background color. Default: '#ffffff' (white)
        level : Error correction level of QR code. Default: 'M'

Some or all key values can be omitted. Defaults will be used for the omitted values. (query['qr'] = {} yields an image completely formatted by the defaults.) Colors must be in #rrggbb or #rrggbbaa format. If aa (alpha) channel is given, transparency can be defined. 'level' can be L, M, Q, H representing the low, medium, quartile, high. Percentage of data that can be restored for each level is 7%, 15%, 25%, and 30% respectively.




OUTPUT ITEMS

entry     dictionary - always exists

Entry for the shortened URL pointing the original URL for redirection. Dictionary items are listed at get_entry





Python Example

import requests, json, hashlib

username = "Test User"
password = "Trial151!"

query = {
  "username_email" : username,
  "password" : hashlib.sha256(hashlib.sha256(password.encode()).digest()).hexdigest(),
}
resp_login = requests.post("https://api.ww7io.com/v2/login", json.dumps(query)).json()

query = {
  "userid" : resp_login['output']['userid'],
  "token"  : resp_login['output']['token'],
  "url"    : "https://examle.com/",
  "tag"    : 0x8008,
}
response = requests.post("https://api.ww7io.com/v2/url", json.dumps(query)).json()


Query
{
  "userid": "FeJr3QgHeHe9D0kAxBBBo9lBidVhrRaU",
  "token": "8hSdMgDzTDXNW0Texqbq7JDcH5hOE0Z4",
  "url": "https://example.com/",
  "tag": 32776
}


Response
{
  "output": {
    "entry": {
      "count": 0,
      "count_qr": 0,
      "enabled": false,
      "encryption": 0,
      "filekey": "",
      "filesize": -1,
      "filetype": "",
      "id": 3576066480,
      "order": 0,
      "shorturl": "https://ww7.io/D4AyPm",
      "signature": "",
      "tag": 32776,
      "url": "https://example.com/",
      "userid": "fCvQf6k7w8JLKWfPuVTA0sybeKHNNQGf",
      "utime": 1663520979909818
    }
  },
  "status": "success",
  "type": "url",
  "utime": 1660552794085981,
  "weight": 1000
}