Postman Collection

The FWURL Postman collection provides a convenient way to explore and test our API endpoints.

What is Postman?

Postman is a popular API development tool that makes it easy to:

  • Test API endpoints
  • Organize requests
  • Save responses
  • Share collections with teams
  • Generate code snippets

If you don't have Postman, download it here.

Importing the Collection

Method 1: Direct Import

  1. Open Postman
  2. Click Import in the top left
  3. Select Link tab
  4. Paste the collection URL: https://api.fwurl.com/postman/collection.json
  5. Click Continue and then Import

Method 2: Manual Download

  1. Download the collection: FWURL API Collection
  2. Open Postman
  3. Click Import
  4. Drag and drop the downloaded file
  5. Click Import

Setting Up

Configure Environment

  1. In Postman, click Environments in the sidebar
  2. Click Create Environment
  3. Name it "FWURL API"
  4. Add these variables:
VariableInitial ValueCurrent Value
baseUrlhttps://api.fwurl.com/v1https://api.fwurl.com/v1
apiKeyyour_api_key_hereyour_api_key_here
  1. Click Save
  2. Select "FWURL API" from the environment dropdown

Get Your API Key

  1. Log in to FWURL Dashboard
  2. Go to Settings > API
  3. Click Generate API Key
  4. Copy the key
  5. Paste it in the apiKey environment variable

Collection Structure

The collection is organized into folders:

  • Create Link
  • Get Link
  • Update Link
  • Delete Link
  • List Links

Analytics

  • Get Link Analytics
  • Get Account Analytics

Domains

  • List Domains
  • Add Domain
  • Verify Domain
  • Delete Domain

QR Codes

  • Generate QR Code

Using the Collection

Making Your First Request

  1. Expand the Links folder
  2. Click Create Link
  3. In the Body tab, you'll see:
{
  "url": "https://example.com",
  "customSlug": "test-link"
}
  1. Modify the URL to your desired destination
  2. Click Send
  3. View the response in the bottom panel

Understanding Requests

Each request includes:

Headers:

  • Authorization (automatically includes your API key)
  • Content-Type (application/json)

Body:

  • Pre-filled with example data
  • Modify as needed for your use case

Tests:

  • Automatic validation of responses
  • Extracts data for use in other requests

Variables

The collection uses variables for reusability:

Environment Variables:

  • {{baseUrl}} - API base URL
  • {{apiKey}} - Your API key

Collection Variables:

  • {{linkId}} - Auto-populated after creating a link
  • {{domainId}} - Auto-populated after adding a domain

Example Workflows

  1. Create Link

    • Run: POST /links
    • Note the id in the response
  2. Get Link Analytics

    • The linkId is automatically set
    • Run: GET /analytics/:linkId
    • View click statistics

Add Custom Domain

  1. Add Domain

    • Run: POST /domains
    • Copy DNS records from response
  2. Configure DNS

    • Add records to your domain
    • Wait for propagation
  3. Verify Domain

    • Run: POST /domains/:domainId/verify
    • Check verification status

Code Generation

Postman can generate code in various languages:

  1. Click on any request

  2. Click the Code icon (</> symbol) in the top right

  3. Select your language:

    • JavaScript (Fetch/Axios)
    • Python (Requests)
    • cURL
    • PHP
    • Ruby
    • And many more
  4. Copy the code snippet

  5. Use in your application

Example Generated Code

JavaScript (Fetch):

const response = await fetch('https://api.fwurl.com/v1/links', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    url: 'https://example.com',
    customSlug: 'my-link'
  })
});
 
const data = await response.json();
console.log(data);

Python (Requests):

import requests
 
url = "https://api.fwurl.com/v1/links"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com",
    "customSlug": "my-link"
}
 
response = requests.post(url, json=data, headers=headers)
print(response.json())

Testing and Validation

Each request includes automated tests:

Response Tests

// Status code validation
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
 
// Response structure validation
pm.test("Response has success field", function () {
    pm.expect(pm.response.json()).to.have.property('success');
});
 
// Save link ID for later use
pm.test("Save link ID", function () {
    const response = pm.response.json();
    pm.environment.set("linkId", response.data.id);
});

Running Tests

  1. Select a folder or the entire collection
  2. Click Run in the top right
  3. Choose requests to run
  4. Click Run [Collection Name]
  5. View test results

Troubleshooting

Authentication Errors

If you receive 401 Unauthorized:

  1. Check that your API key is correct
  2. Ensure the apiKey environment variable is set
  3. Verify the environment is selected
  4. Try generating a new API key

Connection Errors

If requests fail to connect:

  1. Check your internet connection
  2. Verify the baseUrl is correct
  3. Check for firewall/proxy issues
  4. Try disabling SSL verification (for testing only)

Rate Limit Errors

If you receive 429 Too Many Requests:

  1. Wait for the rate limit to reset
  2. Check the X-RateLimit-Reset header
  3. Consider upgrading your plan
  4. Implement request throttling

Sharing with Team

Export Collection

  1. Right-click the collection
  2. Select Export
  3. Choose Collection v2.1
  4. Share the JSON file

Publish to Workspace

  1. Right-click the collection
  2. Select Share
  3. Choose your workspace
  4. Set permissions (View/Edit)

Keep Collection Updated

The FWURL API evolves over time. To get updates:

  1. Watch for collection update notifications
  2. Re-import the collection periodically
  3. Follow our Changelog
  4. Join our Developer Community

Next Steps