Adding new entries into Attendance doctype with APIs

I want to append the attendance data using API’s, Im not able to use POST method I’m getting the error "Method not allowed if i try doing it " this way

@app.route('/s', methods=['POST'])
def attendance_assignment():
    doctype_name = 'Attendance'
    fields = ('["employee","employee_name","working_hours","status","leave_type","leave_application",'
              '"attendance_date","company","department","attendance_request","shift","in_time","out_time",'
              '"late_entry","early_exit","docstatus" ]')
    # filters = '[["start_date",">=","2023-10-12"]]'
    headers = {
        'Authorization': "token 9034*****71ff12:f6*****3784",  # admin
        'Content-Type': 'application/json',
        "Accept": "application/json",
    }
    attendance_url = url + doctype_name + '?fields=' + fields
    data = {
        "naming_series": "HR-ATT-.YYYY.-",
        "employee": "HR-EMP-00005",
        "attendance_date": "2023-10-13",
        "status": "Present",
        "company": "Prerana",
        # "employee_name": "Nanditha",
        "working_hours": 0,
        # "leave_type": "Nikitha",
        # "leave_application": "2023-10-13",
        # "department": "Active",
        # "attendance_request": "Prerana",
        "shift": 3,
        # "in_time": "8:30:00",
        # "out_time": "17:30:00",
        "late_entry": 0,
        "early_exit": 0,
        # "docstatus": 0
    }

    try:
        data_json = json.dumps(data)
        employee_response = s.request("POST", attendance_url, data=data_json, headers=headers)
        # s.get((url + doctype_name + fields + filters), headers=headers))
        if employee_response.status_code == 200:
            employee_data = employee_response.json()
            return jsonify(employee_data)
        else:
            return jsonify({"Code": f"Code is : {str(employee_response.status_code)}"}), 500
    except Exception as e:
        return jsonify({"error": f"An error occurred: {str(e)}"}), 500

Instead if I try using

@app.route('/s', methods=['GET','POST'])

It’ll go in but cannot append the data into the doctype I’m able to retrive the data using API calls on the same doctype but unable to POST new entries on to it, If i do POST i’ll get 417 error

Is there anything which should be taken care of, while posting the entries into the Doctypes

Anyone Please reply