API Endpoints
Managing and using Pulpminer API endpoints
API Endpoints
Pulpminer API endpoints are unique URLs that return JSON data from your configured webpages. This guide explains how to create, manage, and use your API endpoints effectively.
Creating an Endpoint
-
Generate JSON
- Enter webpage URL
- Select a scraper (scraper 1, scraper 2, etc.)
- Get AI-generated JSON
- Customize structure if needed
-
Configure Settings
- Enable/disable caching
- Toggle use session (only available with Scraper 1, establishes a session with the origin URL before connecting to the target URL)
- Configure dynamic variables (optional)
- Review JSON format
- Save configuration
-
Get Endpoint URL
- Endpoint format:
https://api.pulpminer.com/external/{api_id}
- Copy from dashboard
- Note the API ID
- Endpoint format:
Available Scrapers
When creating or editing an API endpoint, you can select from different numbered scrapers. Each scraper is optimized for different types of webpages and content extraction needs. Try different scrapers to find the one that works best for your specific use case.
Managing Endpoints
Dashboard Overview
Your API dashboard shows:
- All active endpoints
- Source URLs
- Cache status
- Session state
- Dynamic variable status
- Last fetch time
- Usage statistics
Endpoint Status
Monitor each endpoint’s:
- Active/Inactive status
- Cache configuration
- Session state configuration (Scraper 1 only)
- Dynamic variable settings
- Last update time
- Response format
Using Endpoints
Making Requests
Basic Request (Static)
Dynamic Request (With Variables)
With Error Handling
Dynamic Variables
What Are Dynamic Variables?
Dynamic variables allow you to create flexible API endpoints where parts of the URL path or query parameters can be customized at request time. This is useful for:
- Product pages with different IDs
- Search results with variable parameters
- Category listings with changeable filters
- User profiles with different usernames
Setting Up Dynamic Variables
- Enable Dynamic Variables
- Toggle the “Enable Dynamic Variables” switch when creating or editing an API
- Configure Path Parameters
- Identify segments in the URL path that should be variable
- Toggle the checkbox for each segment you want to make dynamic
- Enter a descriptive variable name for each segment
- Configure Query Parameters
- Identify query parameters that should be variable
- Toggle the checkbox for each parameter you want to make dynamic
- Enter a descriptive variable name for each parameter
- Preview Dynamic URL
- Review how your dynamic URL will look with variable placeholders
- Format:
https://example.com/{{ productId }}/details?category={{ category }}
Using Dynamic Endpoints
To use a dynamic endpoint, send a POST request with a JSON body containing your variable values:
Response Format
Success Response
Error Response
Best Practices
1. Endpoint Management
- Keep endpoints organized
- Monitor usage patterns
- Update configurations as needed
- Document endpoint purposes
2. Error Handling
- Implement proper error handling
- Use retry logic
- Monitor for failures
- Log issues appropriately
3. Performance Optimization
- Enable caching when appropriate
- Monitor response times
- Track usage patterns
- Optimize request frequency
4. Dynamic Variable Best Practices
- Use descriptive variable names
- Document required variables
- Consider using default values in your application
- Keep variable names consistent across endpoints
Implementation Examples
Node.js Service
Python Client
Common Use Cases
1. Content Aggregation
2. Product Information
3. Data Monitoring
4. Data Integration
Troubleshooting
Common Issues
-
Invalid Endpoint
- Verify API ID
- Check endpoint status
- Confirm URL format
- Test with curl
-
Authentication Errors
- Verify API key
- Check header format
- Confirm key is active
- Test key separately
-
Data Issues
- Check source webpage
- Verify JSON format
- Review cache settings
- Test endpoint directly
-
Dynamic Variable Issues
- Verify variable names match those in configuration
- Check Content-Type header is set to application/json
- Ensure all required variables are provided
- Test with curl using the exact variable names
Monitoring
Key Metrics
- Response time
- Success rate
- Error frequency
- Usage patterns
Alerts
Set up alerts for:
- Endpoint failures
- High latency
- Error spikes
- Usage thresholds
Need Help?
If you’re having endpoint issues:
- Check endpoint status
- Verify configuration
- Test with curl
- Contact support at hello@pulpminer.com