How do I write the ‘post’ code for such api’s ? Can anyone share with me an example?

Have you looked at the redash-toolbelt library? There is a complete example of how to refresh a parameterised query in Python there: redash-toolbelt/refresh_query.py at master · getredash/redash-toolbelt · GitHub