Skip to content

Instantly share code, notes, and snippets.

@alexmdcampo
Last active March 9, 2021 16:46
Show Gist options
  • Save alexmdcampo/2d3f6dc404def7af63ed9f108abf28a3 to your computer and use it in GitHub Desktop.
Save alexmdcampo/2d3f6dc404def7af63ed9f108abf28a3 to your computer and use it in GitHub Desktop.

🚧 URL.TO πŸš€ Under construction... 🚧

URL.TO App for shorting URL, simple and fast, send URL and Shortcut and BOOM shorted.

https://www.urlto.info/{ Shortcut }

Features

  • API gen shortcut
  • API Key manager
  • Rate limit
  • Slow down
  • Analytics

Short URL

Returns json data about a single URL shorted.

  • URL

    https://www.urlto.info/API/

  • Method:

    POST

  • URL Params

    Required:

    URL=[sring] API_KEY=[sring] shortcut=[sring]

  • Data Params

    None

  • Rate Limit:

    max: 2 window: 30s

  • Success Response:

    • Code: 200
      Content:
      { 
      "url" : "https://myspotter.app", 
      "slug" : "myspotter", 
      "_id": "604798c9a6d047e81a23cf03" 
      }
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { error : "not found" }

    OR

    • Code: 401 UNAUTHORIZED
      Content: { error : "Ops, you need an API KEY." } Request API KEy to alex.mdcampo@gmail.com

    OR

    • Code: 500 INTERNAL SERVER ERROR
      Content: { message : "shortcut in use." }

      This shortcut already in use

    OR

    • Code: 500 INTERNAL SERVER ERROR
      Content: { message : "Stop it." }

      Don`t use the server URL (https://www.urlto.info) to short

  • Sample Call:

     $.ajax({
     	url: "/API/",
     	dataType: "json",
     	type : "POST",
     	success : function(r) {
     	console.log(r);
     }
     });

    Node.js

     	var request = require('request');
     	var options = {
     	'method': 'POST',
     	'url': 'https://www.urlto.info/API',
     	'headers': {
     	'Content-Type': 'application/json',
     	'Cookie': '__cfduid=d7dd64f3b426ab463f74a31dbdd556a4f1615305473'
     	},
     	body: JSON.stringify({"url":"https://www.myspotter.app","API_KEY":"66666","shortcut":"myspotter"})
    
     	};
     	request(options, function (error, response) {
     	if (error) throw new Error(error);
     	console.log(response.body);
     	});

    cURL

     curl --location --request POST 'https://www.urlto.info/API' \
     --header 'Content-Type: application/json' \
     --header 'Cookie: __cfduid=d7dd64f3b426ab463f74a31dbdd556a4f1615305473' \
     --data-raw '{
     	"url": "https://www.myspotter.app",
     	"API_KEY": "66666",
     	"shortcut": "myspotter"
     }'
     
    • Insomnia API

    Insomnia

    Buy Me A Coffee

Made with πŸ’œ by Alex Campo πŸ‘‹ alex.mdcampo@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment