GET : http://127.0.0.1:8000/r/
{
"count": 5,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"url": "http://127.0.0.1:8000/r/1/",
"name": "India",
"code": 91
},
{
"id": 2,
"url": "http://127.0.0.1:8000/r/3/",
"name": "us",
"code": 10,
},
{
"id": 3,
"url": "http://127.0.0.1:8000/r/4/",
"name": "pak",
"code": 9
},
{
"id": 4,
"url": "http://127.0.0.1:8000/r/5/",
"name": "kansas",
"code": 44
},
{
"id": 5,
"url": "http://127.0.0.1:8000/r/6/",
"name": "kanada",
"code": 123
}
}
我知道,假设我可以通过在http://127.0.0.1:8000/r/2之类的URL中指定id来获得“ name”:“ us”,“ code”:10(基于其“ id”:2), 通过使用GET方法, 但我想通过使用“ POST”方法将其作为json对象发送(表示“ id”)作为json对象来检索“ name”:“ us”,“ code”:10(基于它的“ id”:2)。