Api Documentation

API Shortlink Documentation

Endpoint: URL Shortening

Request:

        Method: GET
        Endpoint: https://ytsubunlock.my.id/api/create?url=https://example.com&token=Your_Token
      

Example Implement Use Html Js:

  
    <!-- Form to create a shortlink using API -->
    <form id="shortlinkForm">
      <label for="longUrl">Enter URL:</label>
      <input type="text" id="longUrl" name="url" required>
      <button type="submit">Shorten URL</button>
    </form>

    <script>
      document.getElementById('shortlinkForm').addEventListener('submit', function(event) {
        event.preventDefault();
        const longUrl = document.getElementById('longUrl').value;
        const token = 'Your Token'; // Your API token

        const apiUrl = `https://ytsubunlock.my.id/api/create?url=${encodeURIComponent(longUrl)}&token=${token}`;
        
        fetch(apiUrl)
          .then(response => response.json())
          .then(data => {
            console.log('Shortened URL:', data.short);
            console.log('Original URL:', data.long_url);
            // You can display or use the shortened URL and original URL here
          })
          .catch(error => console.error('Error:', error));
      });
    </script>
  

Use Php

        
          <!-- Form untuk memasukkan URL yang ingin dipendekkan -->
          <form action="shortlink.php" method="POST">
            <label for="longUrl">Enter URL:</label>
            <input type="text" id="longUrl" name="url" required>
            <button type="submit">Shorten URL</button>
          </form>
        
      

Code shortlink.php

  
    <?php
    if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['url'])) {
        // URL yang ingin dipendekkan
        $url = $_POST['url'];
        
        // Token untuk mengakses API
        $token = "your-token";
        
        // Endpoint untuk membuat shortlink
        $apiUrl = "https://ytsubunlock.my.id/api/create?url=" . urlencode($url) . "&token=" . $token;
        
        // Melakukan permintaan ke API
        $response = file_get_contents($apiUrl);
        
        // Mengecek apakah permintaan berhasil
        if ($response) {
            $result = json_decode($response, true);
            // Menampilkan hasil permintaan
            var_dump($result);
        } else {
            echo "Failed to fetch data from API.";
        }
    }
    ?>
  

API Token Pricing

Pricing Details:

  • Unlimited Redirect:
  • Unlimited Create Link:
  • Speed Redirect:
  • Unlimited Traffic:
  • Custom Domain: NO

Pricing:

Price for API Token: $30 per year

Pay Token API via WhatsApp

Posting Komentar

0Komentar
Posting Komentar (0)