TinyUrl

TinyUrl

URL Shorteners

TinyUrl is a URL shortening service that allows users to shorten long URLs into shorter, more manageable ones. This service is commonly used to share links on social media platforms or via email, where character limits are often enforced. With TinyURL, users simply copy and paste the long URL into the provided field and click a button to generate a shortened URL. This service also allows users to customize the shortened URL, making it easier to remember and share. Overall, TinyURL is a quick and easy solution for shortening lengthy URLs and sharing them with others.

Visit API

📚 Documentation & Examples

Everything you need to integrate with TinyUrl

🚀 Quick Start Examples

TinyUrl Javascript Examplejavascript
// TinyUrl API Example
const response = await fetch('https://tinyurl.com/app/dev', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Working with the Public API Docs of https://tinyurl.com/app/dev in JavaScript

Accessing public APIs is an excellent way of integrating different applications and services, giving developers freedom to create sophisticated applications. In this blog post, we'll look at how to use the public API docs of https://tinyurl.com/app/dev in JavaScript.

Getting Started

To get started, you'll need to obtain an API key from https://tinyurl.com/app/dev. This API key is required for authentication with the server, and without it, you won't be able to access any data.

Once you've obtained the API key, you can start integrating the API into your application. The first step is to authenticate with the server using your API key. Below is an example of how to authenticate with the server using the fetch() function in JavaScript.

const apiKey = '<YOUR_API_KEY>'
const url = 'https://tinyurl.com/app/dev/authenticate'

fetch(url, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${apiKey}`
    }
})
.then(response => {
    if (response.ok) {
        return response.json()
    }
    throw new Error('Authentication failed')
})
.then(data => {
    console.log(data)
})
.catch(error => {
    console.error(error)
})

Queries

Once authenticated, you can start making queries to the server for data. The API documentation at https://tinyurl.com/app/dev provides a list of available endpoints and parameters. Below is an example of how to query the server for data using the fetch() function in JavaScript.

const apiKey = '<YOUR_API_KEY>'
const url = 'https://tinyurl.com/app/dev/query'

const query = {
    endpoint: 'users',
    parameters: {
        page: 1,
        limit: 10
    }
}

fetch(url, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${apiKey}`
    },
    body: JSON.stringify(query)
})
.then(response => {
    if (response.ok) {
        return response.json()
    }
    throw new Error('Failed to retrieve data')
})
.then(data => {
    console.log(data)
})
.catch(error => {
    console.error(error)
})

Modifying Data

The API also allows modifying data on the server. To modify data, you'll need to use the PUT or POST methods in the fetch() function in JavaScript. Below is an example of modifying data on the server.

const apiKey = '<YOUR_API_KEY>'
const url = 'https://tinyurl.com/app/dev/data'

const data = {
    endpoint: 'users',
    payload: {
        id: 1,
        name: 'John'
    }
}

fetch(url, {
    method: 'PUT', // or 'POST'
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${apiKey}`
    },
    body: JSON.stringify(data)
})
.then(response => {
    if (response.ok) {
        return response.json()
    }
    throw new Error('Failed to modify data')
})
.then(data => {
    console.log(data)
})
.catch(error => {
    console.error(error)
})

Conclusion

In this blog post, we've looked at how to use the public API docs of https://tinyurl.com/app/dev in JavaScript. You can now start integrating the API into your application for a seamless flow of data. Happy coding!

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 12Jun 14Jun 16Jun 18Jun 20Jun 22Jun 24Jun 26Jun 28Jun 30Jul 2Jul 4Jul 6Jul 8Jul 1104008001440Minutes
Online
Offline

Related APIs in URL Shorteners