title: How to fetch data from API and save into data base in rest framework in Django?
body: <p>How to fetch data from API and save it to the database as given below code in rest framework in Django?</p>
  <pre><code>if user is None:
   URL = &quot;http://172.31.0.3:8000/studentapi/&quot;
   URLDATAS = &quot;https://reqres.in/api/users?id=2&quot;
   data1 = {}
   if uname is not None:
    data1 = {'id':uname}
    json_data = json.dumps(data1)
    headers = {'content-Type':'application/json'}
    r_get = requests.get(url = URLDATAS, headers=headers, data = json_data)
    data = r_get.json()
                           
    r_post = requests.post(url = URL, headers=headers, data = data)
              
  </code></pre>