Weblutions Documentation
Weblutions Main Site Contact Us Our Discord
Product Documentation IconProduct Documentation

Weblutions Documentation / Product Documentation / WLink API

Updated

WLink API

By Josh M. 1 mins 15

From version 1.2.0 WLink comes with an API which can be used to automate the process of creating, deleting and fetching links. Accepted content types for WLink are application/json or application/x-www-form-urlencoded.

Before Using the API

  • Ensure WLink 1.2.0 or above is running

  • The API token has been changed in the config.json


Fetch an existing link by the link/URL name.

Parameters

authorization

[Header] The token set in the config file

name

[URL] The name or url of the link to search for

Response

{
  id: 2,
  name: 'g',
  url: 'https://google.com',
  count: 7,
  creator: 'faxes',
  creatorID: '282762192544333827',
  createdAt: '1713090722076'
}

OR

{msg: 'Link not found from name or url.'}

POST /api/link

Create a link to be used as a shortened URL.

Parameters

authorization

[Header] The token set in the config file

name

[Body] The short name for the link

url

[Body] The URL the link should direct towards

Response

{
  id: 2,
  name: 'g',
  url: 'https://google.com',
  count: 0,
  creator: 'API',
  creatorID: '0',
  createdAt: '1713090722076'
}

OR

400: {msg: 'Body fields not passed, name and url are required.'}
409: {msg: 'Duplicate link name.'}
403: {msg: 'Reserved name provided. Paths that the application use are reserved.'}

Delete a link from the system and returns the final data before it's removed.

Parameters

authorization

[Header] The token set in the config file

id

[URL] The numerical ID of the link to delete

Response

{
  id: 2,
  name: 'g',
  url: 'https://google.com',
  count: 7,
  creator: 'faxes',
  creatorID: '282762192544333827',
  createdAt: '1713090722076'
}

OR

{msg: 'Link not found from the ID'}