Error while update field value


  1. create new field type in User doctype
  2. then use PUT method /api/resource/User/username
  3. send parameter [“data”:[“field type key”: “field type value”]]
  4. then error Status Code: 500


“exc” : “["Traceback (most recent call last):\n File \"/home/frappe/frappe-bench/apps/frappe/frappe/\", line 60, in application\n response = frappe.api.handle()\n File \"/home/frappe/frappe-bench/apps/frappe/frappe/\", line 85, in handle\n data = json.loads(frappe.local.request.get_data())\n File \"/usr/lib/python3.6/json/\", line 354, in loads\n return _default_decoder.decode(s)\n File \"/usr/lib/python3.6/json/\", line 339, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"/usr/lib/python3.6/json/\", line 357, in raw_decode\n raise JSONDecodeError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n"]”

it should be in json form like

{"data": {"fieldname": "field type value"}}


{"data": {"first_name": "John", "last_name": "Doe"}}

yes I do same thing but got error

what is payload type?

I am not getting your point.

sorry my bad! what is ‘content-type’ for request?

import requests

url = "{ your_url }/api/resource/{ path }"

payload = "{\n\t\"first_name\": \"Saurabh\"\n}\n"
headers = {
    'content-type': "text/plain"

response = requests.request("PUT", url, data=payload, headers=headers)


I use below line
“Content-Type”: “application/json”

:+1: Great


update multiple parameter suppose I want update first name and last name then what can i do?

got solution

{\n\t"first_name": "Mohsin…"\n,\n\t"last_name": "Ali…"\n}