Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
key error when trying to make a auth api "post request

im very new to react and coding in general im learning now to make api requests this is my react post request.

    handleSubmit(event) {
        axios.post("http://127.0.0.1:5000/user", {
            user: {
                name: this.state.name,
                email: this.state.email,
                password: this.state.password,
                streetAddress: this.state.streetAddress,
                city: this.state.city,
                state: this.state.state,
                zip: this.state.zip,
            },
        });

this is my flask api post method my error im getting is name = request.json['name'] KeyError: 'name'

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

def create_user():
    
    name = request.json['name']
    email = request.json['email']
    password = request.json['password']
    streetAddress = request.json['streetAddress']
    city = request.json['city']
    state = request.json['state']
    zip = request.json['zip']

    


    new_user = User(name , email, password,streetAddress,city,zip,state)

    db.session.add(new_user)
    db.session.commit()

    return user_schema.jsonify(new_user)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

def create_user():
    data = request.json.get("user")
    name = data.get("name")
    email = data.get("email")
# and so on...

explanation on .get()

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!