Can't update data : get error [HTTP/1.1 500 Internal Server Error 527ms]

I have problem when I want to update an element from my form.
here is my code:

<script setup>
    const updateSupply = async () => {
        errors.value = ""
        try {
            await axios.put("" + "supply");
        } catch (e) {
            if (e.response.status === 422) {
                for (const key in {
                    errors.value =

const { destroySupply, updateSupply, updateClick } = useSupply();

const saveSupply = async () => {
  // console.log("Test");
  await updateSupply();
  // supply_id:this.supply_id,

<!-- Modal -->
    title="Update supply"
    <form @submit.prevent="saveSupply">
        <FormField label="Noms & Email">
            placeholder="name supply"
            placeholder="Email supply"

        <!-- Buttons footer -->
        <BaseButtons class="flex justify-center">


The Django code

# SupplyApi
def supplyApi(request,id=0):
    if request.method=='GET':
        supplies = Supplies.objects.all()
        supplies_serializer = SupplySerializer(supplies,many=True)
        return JsonResponse(,safe=False)
    elif request.method == 'POST':
        supply_data = JSONParser().parse(request)
        supplies_serializer = SupplySerializer(data=supply_data)
        if supplies_serializer.is_valid():
            return JsonResponse("Added Successfully",safe=False)
        return JsonResponse("Failed to Add",safe=False)
    elif request.method =='PUT':
        supply_data = JSONParser().parse(request)
        supply = Supplies.objects.get(supply_id=supply_data['supply_id'])
        supplies_serializer = SupplySerializer(supply,data=supply_data)
        if supplies_serializer.is_valid():
            return JsonResponse("Updated Successfully",safe=False)
        return JsonResponse("Failed to Update")
    elif request.method == 'DELETE':
        supply = Supplies.objects.get(supply_id=id)
        return JsonResponse("Deleted Successfully",safe=False)

Somehow i get this error [HTTP/1.1 500 Internal Server Error 527ms].
And the django server error :

IInternal Server Error: /supply
Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\rest_framework\", line 64, in parse
    return json.load(decoded_stream, parse_constant=parse_constant)
  File "C:\Python311\Lib\site-packages\rest_framework\utils\", line 31, in load
    return json.load(*args, **kwargs)
  File "C:\Python311\Lib\json\", line 293, in load
    return loads(,
  File "C:\Python311\Lib\json\", line 359, in loads
    return cls(**kw).decode(s)
  File "C:\Python311\Lib\json\", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python311\Lib\json\", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\django\core\handlers\", line 55, in inner
    response = get_response(request)
  File "C:\Python311\Lib\site-packages\django\core\handlers\", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Python311\Lib\site-packages\django\views\decorators\", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File "C:\Users\rt-enterprises\OneDrive\RTSOFTT\PROJECTS\Python Projects\JT_ORDER-FILES\jt_orders\jt_orders_app\", line 42, in supplyApi
    supply_data = JSONParser().parse(request)
  File "C:\Python311\Lib\site-packages\rest_framework\", line 66, in parse
    raise ParseError('JSON parse error - %s' % str(exc))
rest_framework.exceptions.ParseError: JSON parse error - Expecting value: line 1 column 1 (char 0)

PS : Below is my store code which works perfectly for it

const storeSupply = async (data) => {
        errors.value = ""
        try {
            await"" + "supply", data);
        } catch (e) {
            if (e.response.status === 422) {
                for (const key in {
                    errors.value =


What did I do wrong ?
Thank you for you help

You need to parse just the body of the request as json, not the full request. The request object is an instance of HttpRequest, the data being submitted within the request is stored in the body attribute of that request.

(Also, I’m not familiar with axios, but I don’t see where you’re submitting any data within that request. Is that something done implicitly with axios? If not, that’s something else to check.
You might also want to verify that the submission is done of a JSON object and not HTML form data.)

@KenWhitesell , I am still lost and without issue, I carefully consulted the documentation that you advised me, but nothing helped I still stagnate with the same problem.

What attribute of the request object contains the JSON data being submitted in the request?

I found the solution to my problem.
First I changed the backend by adding:
supply = Supplies.objects.get(supply_id=id) in place of supply = Supplies.objects.get(supply_id=supply_data["supply_id"]).
Please see full code below
Django code

elif request.method == "PUT":
    supply_data = JSONParser().parse(request)
    supply = Supplies.objects.get(supply_id=id)
    supplies_serializer = SupplySerializer(supply, data=supply_data)
    if supplies_serializer.is_valid():
       return JsonResponse("Updated Successfully", safe=False)
    return JsonResponse("Failed to Update")

then I modified the storeSupply or updateSupply function by

const updateSupply = async (id) => {
  console.log("Access successfully");
  await axios
    .put("" + "supply/" + id, {
      supply_address: form.supply_address,
      supply_city: form.supply_city,
      supply_email: form.supply_email,
      supply_name: form.supply_name,
      supply_phone: form.supply_phone,
      supply_zip_code: form.supply_zip_code,
    .then((response) => {
      // alert(; Put toast here

and it works now without problem, thank you all for your help.