Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
The Tiny1z API Client is a convenient and lightweight npm package that allows developers to seamlessly integrate the Tiny1z URL Shortener API into their applications. Simplify URL shortening, retrieval, and management with just a few lines of code.
The Tiny1z API Client is a powerful and lightweight npm package designed to simplify the integration of Tiny1z URL Shortener API into your applications. This client provides functions to create short URLs, retrieve user-specific URLs, get information about a single URL, and fetch all created URLs.
npm install tiny1z
To integrate the Tiny1z API into your applications, you'll need a Tiny1z API key. Follow these steps to obtain your API key:
Sign up for a Tiny1z account:
Access your developer dashboard:
Retrieve your API key:
Now you are ready to start using the Tiny1z api.
Example:
import { createSingleUrl } from 'tiny1z';
const apiKey = 'your-api-key';
const data = {
originalUrl: 'https://www.example.com',
// additional data...
};
const response = await createSingleUrl(data, apiKey);
// Import Tiny1z API functions
import { createSingleUrl, createBulkUrl, getUserUrls, singleUrlInfo, getAllUrls } from 'tiny1z';
// Replace 'your-api-key' with your actual API key
const apiKey = 'your-api-key';
// Create a single URL
const singleUrlData = {
"original_url": "https://www.example.com", // Required: The original URL to be shortened.
"alias": "alias-example", // Optional: A custom alias for the shortened URL.
"password": "123456", // Optional: A password to access the url
"expiry_duration": 5, // Optional: Expiry duration
"expiry_unit": "hours", // Optional: Expiry unit. Accepts 'hours', 'days' or 'months' only.
"user_reference": "adam" // Optional: Any tag like a user_id or anything you wish to label this url with
};
const singleUrlResponse = await createSingleUrl(singleUrlData, apiKey);
// Create multiple URLs in bulk
const bulkData = {
"original_urls": [
{
"url": "https://www.example.com", // Required: The original URL to be shortened.
"alias": "alias-example", // Optional: A custom alias for the shortened URL.
"password": "123456", // Optional: A password to access the url **overrides the global password**
"expiry_duration": 5, // Optional: Expiry duration
"expiry_unit": "hours", // Optional: Expiry unit. Accepts ('hours', 'days' or 'months') only.
},
{
"url": "https://www.example.com"
}
],
"global_password": null,
"global_expiry_duration": null,
"global_expiry_unit": null,
"user_reference": "ali" // Optional: Any tag like a user_id, username or anything you wish to label this urls with
};
const bulkUrlResponse = await createBulkUrl(bulkData, apiKey);
// Get user URLs by user reference
const userReference = 'user_reference'; // Required: The user reference used when creating the URLs.
const userUrls = await getUserUrls(userReference, apiKey);
// Get information about a single URL by slug
const slug = 'alias-example'; // Required: The slug/alias of the short URL you want to fetch.
const singleUrlInfoResponse = await singleUrlInfo(slug, apiKey);
// Get all user URLs with pagination and sorting
const offset = 0; // Required: The starting index from which the data should be fetched.
const limit = 10; // Required: The maximum number of rows to be fetched.
const sort = 'desc'; // Required: The sorting method for the fetch operation ('desc' or 'asc').
const allUserUrls = await getAllUrls(offset, limit, sort, apiKey);
For detailed information on API endpoints, parameters, and response formats, refer to the Tiny1z API Documentation.
Be aware of the rate and usage limits when using the Tiny1z API. Ensure you include your API key in the Authorization header for each request.
If you'd like to contribute to the development of this package, feel free to submit pull requests or open issues on the GitHub repository.
FAQs
The Tiny1z API Client is a convenient and lightweight npm package that allows developers to seamlessly integrate the Tiny1z URL Shortener API into their applications. Simplify URL shortening, retrieval, and management with just a few lines of code.
The npm package tiny1z receives a total of 7 weekly downloads. As such, tiny1z popularity was classified as not popular.
We found that tiny1z demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.