python rest frameworkのBrowsable APIにより、ブラウザ上でApiを叩く
前回、text/html形式でApiを出力できるようにしましたが、
text/htmlで出力できるようにしたことにより、ブラウザ上でapiの確認ができるようになります。
この機能をThe Browsable APIというようです。
Browsable APIを表示する
Django Serverが立ち上がっている状態で、ブラウザにlocalhostと共に作成したapiのアドレスを入力します。 例として、
http://localhost:8000/flowers/
と入力してみます。
すると、以下のようにブラウザ上で、Responseを確認することができ、
apiも叩くことができます。

Browsable APIでPOST METHODを叩く
APIを叩く例として、flower_detail apiのPOST METHODを叩いてみたいと思います。
flower_detail api用の画面を出力するために、
http://localhost:8000/flowers/
とブラウザに入力し、flower_list apiを表示させます。
画面下部にContent欄があるので、
POSTする内容をJSON形式で入力し、
下部にあるPOSTボタンをタップします。
{
"name":"Cherry blossom",
"description":"Cherry blossom",
"flower_category":"Rosaceae",
"was_included_in_home": "false",
"release_date": "2018-05-10T01:01:00.555555Z"
}

こんな感じでApiをブラウザ上で叩くことができます。
こちらを参考に、知識をまとめています。
初版:2018/6/3