Magento calculate shipping rates base on total weight, province and country

I am new to Magento and I need to calculate shipping rates base on total weight in cart, province and the country during checkout, I have created an api to output rates in json format, but I have no idea how to call to the api in Magento. Usually I used to request the api through http request, but in magento I don't know how to integrate my api in it.

is there any plugin so that I can simply use?