I am creating an application where I need to call REST API related to create data source as mentioned here: https://docs.microsoft.com/en-us/azure/search/search-howto-indexing-
You're posting to the wrong URL try the following
https://[service name].search.windows.net/datasources?api-version=2016-09-01