Also if you are just doing this for testing, it might be worth looking into some friendly tool like httpie. [1] (Otherwise you'll probably want to use an existing library; [2] there are all kinds of edge cases in handling the API which take a bit of effort to reimplement.)