Home Applications cos-url-shortener

cos-url-shortener

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
1 reviews
0
Awards
174
Views
2
IPM installs
0
1
Details
Releases
Reviews
Issues
Pull requests
Videos
Articles
URL Shortener project with campaign tag and clicked control.

What's new in this version

Added pythom embedded like a random string generator.

This project is based in the project intersystems-community/iris-rest-api-templates (a template of a REST API application built with ObjectScript in InterSystems IRIS)

Quality Gate Status

Quality gate

Use

Clone/git pull the repo into any local directory e.g. like it is shown below
(here I show all the examples related to this repository, but I assume you have your own derived from the template):

$ git clone https://github.com/daniel-aguilar-garcia/cos-url-shortener.git

Open the terminal in this directory and run:

$ docker-compose up -d --build

How to Work With it

Testing POST request

Create a POST request e.g. in Postman with raw data in JSON. e.g.

{"LongUrl":"https://www.google.es","Campaing":"TEST", "Length":6, "ExpirationDays": 7}

Adjust the authorization if needed - it is basic for container with default login and password for IRIR Community edition container

and send the POST request to localhost:52773/

This will create a record in AQS.urlShortener.Url class of IRIS.

Testing Navigate to Long Url requests

To navigate to the long url associated for a particular record provide the id in GET request like ‘localhost:52773/shortUrl’ . E.g.:

localhost:52773/RPLMMG

This will redirect the user to the long url associated to the short link.

Testing GET requests

To request the data for a particular record provide the id in GET request like ‘localhost:52773/info/id’ . E.g.:

localhost:52773/info/RPLMMG

This will return JSON data for the url associated to the short link RPLMMG, something like that:

{"ShortUrl":"RPLMMG","LongUrl":"https://www.google.es","Campaing":"TEST","Length":6,"Clicked":false,"ExpirationDays":7,"ExpirationDate":66517}

Testing DELETE request

For delete request this REST API expects only the id of the record to delete. E.g. if the id=5 the following DELETE call will delete the record:

localhost:52773/delete/5

Task autodelete expired links

For autodelete expired links just create a task in the portal an call this method.

##class(AQS.urlShortener.Url).DeleteExpiredUrl()
Read more
Made with
Install
zpm install cos-url-shortener download archive
Version
1.0.409 Feb, 2023
ObjectScript quality test
Category
Solutions
Works with
InterSystems IRISInterSystems IRIS for Health
First published
05 Feb, 2023
Last checked by moderator
27 Jun, 2023Works