Introduction to FilterLists API Docs

FilterLists is a website that provides a publicly available API for accessing data on ad-blocking filters. This API can be used to integrate ad-blocking functionality into your website or application. In this blog post, we will explore the FilterLists API documentation and provide some useful JavaScript example code.

API Examples

Search for Filter Lists

To search for lists based on specific criteria, you can use the GET /search endpoint.

const searchUrl = 'https://filterlists.com/api/v1/search';
const searchTerm = 'adblock';
const resultsPerPage = 10;
const pageNumber = 1;
const queryParams = `?q=${searchTerm}&per_page=${resultsPerPage}&page=${pageNumber}`;

fetch(searchUrl + queryParams)
  .then(response => response.json())
  .then(data => console.log(data));

In the above example, we are searching for all filter lists that contain the term "adblock" and returning 10 results per page on page 1.

Get a List by ID

To get information on a specific list, you can use the GET /lists/:id endpoint.

const listUrl = 'https://filterlists.com/api/v1/lists';
const listId = 1;

fetch(listUrl + `/${listId}`)
  .then(response => response.json())
  .then(data => console.log(data));

In the above example, we are getting information on the filter list with ID 1.

Get a List's Rules

To get the rules for a specific list, you can use the GET /lists/:id/rules endpoint.

const ruleUrl = 'https://filterlists.com/api/v1/lists';
const listId = 1;

fetch(ruleUrl + `/${listId}/rules`)
  .then(response => response.json())
  .then(data => console.log(data));

In the above example, we are getting the rules for the filter list with ID 1.

Conclusion

In this blog post, we have covered some of the basic examples of how to use the FilterLists API to search for filter lists, get information on a specific list, and get a list's rules. These examples should give you a good starting point for integrating the FilterLists API into your own website or application. For more detailed documentation, please refer to the official FilterLists API documentation on the website.

Related APIs in Security