You can add this function in any of the Content type by creating a custom api endpoint.
Steps to create custom api can be found here
You can add this function in any of the Content type by creating a custom api endpoint.
Steps to create custom api can be found here