Custom Rules enables build custom API response based on your necessities.
is so powerful for extracting data. We created links previews as one of the possible use cases (actually our SDK
), but because the API response returns generic data, it's a bit difficult use Microlink API for different problems scope.
Now, we are introducing the concept of Custom Rules: The ability to setup custom API response based on user necessities.
Custom Rules work specifying what you want to get using CSS selectors. Also, you can provide consistent types (
date, etc) avoiding getting unexpected value in your data.
In other words, you can use it as a scraper as service 🤯.
We wrote a specific blog
explaining how to use custom rules, taking an Instagram profile as an example.
Ensure to use *Accept-Encoding* for enabling compression
Althought we support brotli
from the beginning, we added
a specific section into the documentation.
Using it, it will save payload size up to 70%, so ensure you are using it!
$ curl -i -I -X GET https://api.microlink.io/?url=https%3A%2F%2Fwww.reddit.com
x-response-time : 21.518ms
x-fetch-mode : fetch
x-fetch-time : 618.055ms
The mission of these headers helps you optimize the response time of the API.
As part of the response header, we added two new headers to help optimize your API calls:
It returns the total amount of time used for processing the API call.
It specifies the way to content will be fetched.
It could be
. The value is strongly related with prerender
It expresses the amount of time spend just in the
every time that Microlink API
detects you are working with
The API response will look like:
"size_pretty": "7.23 MB",
Notes how we provided the field with pretty suffix as well. It's the same value but human readable 👌.