Fetching the API
In the following guide we learn how to make API requests and pass the required parameters.
Required Parameters
All API requests to the Pub Index API require the following parameter:
- API Key: Your unique API key, used for authentication.
- Feed Parameter: The URL of your RSS feed or XML sitemap.
Making API Requests
You can make API requests to the Pub Index API using various methods, including:
- Web browser: Enter the API URL with the required parameters directly in the address bar.
- Command-line tools: Use tools like curl to send HTTP requests from the command line.
- Programming languages: Utilize libraries or built-in functions in languages like Python, JavaScript, or PHP to make API requests.
Web Browser
Because the Pub Index API is a HTTP API you can make calls to the API using just a web browser.
For example:
- /api/ping:
https://api.pubindex.dev/api/ping?feed=your_rss_feed&api-key=xxxx
- /api/rss:
https://api.pubindex.dev/api/rss?feed=your_rss_feed&api-key=xxxx
- /api/sitemap:
https://api.pubindex.dev/api/sitemap?feed=your_news_sitemap&api-key=xxxx
Replace your_rss_feed
, your_news_sitemap
, and xxxx
with your respective RSS feed URL, news sitemap URL, and API key.
Command Line (using curl)
- /api/ping:
curl "https://api.pubindex.dev/api/ping?feed=your_rss_feed&api-key=xxxx"
- /api/rss:
curl "https://api.pubindex.dev/api/rss?feed=your_rss_feed&api-key=xxxx"
- /api/sitemap:
curl "https://api.pubindex.dev/api/sitemap?feed=your_news_sitemap&api-key=xxxx"
Replace your_rss_feed
, your_news_sitemap
, and xxxx
with your respective RSS feed URL, news sitemap URL, and API key.
For added security you can also add your API key to a HTTP header.
- /api/ping:
curl -H "api-key: xxxx" "https://api.pubindex.dev/api/ping?feed=your_rss_feed"
- /api/rss:
curl -H "api-key: xxxx" "https://api.pubindex.dev/api/rss?feed=your_rss_feed"
- /api/sitemap:
curl -H "api-key: xxxx" "https://api.pubindex.dev/api/sitemap?feed=your_news_sitemap"
Programming Languages
For code examples and additional tools, check out the following resources:
Handling API Responses
After making an API request, you’ll receive a response containing relevant information based on the endpoint used. To understand the structure and components of these responses, refer to the API Responses page.