Kind of ugly but for now I guess we can live with it. If we make this any more sophisticated we should use some nicer request library so we can e.g. specify the parameters as JS dictionary.