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

116
Views
Angular calling api/account/register

I am trying to register a user via the web api using Angular 2. My call is as follows:

this.http.post('http://localhost/Authenticated/api/account/register', JSON.stringify(this.cred)).subscribe(function (data) {
    console.log(data);
});

My form is defined:

<form id="userData" (submit)="submitForm()">
    <input type="text" name="userName" placeholder="Name" [(ngModel)]="cred.userName" />
    <input type="password" name="password" placeholder="Password" [(ngModel)]="cred.password"/>
    <input type="password" name="confirmPassword" placeholder="Password" [(ngModel)]="cred.confirmPassword"/>
    <input type="submit" id="register" value="Register" />
</form>

When I make a post I am getting an HTTP415 error:

HTTP415: UNSUPPORTED MEDIA TYPE - The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It depends on your web API mostly for login/register we post form data with this Content-Type Content-Type: application/x-www-form-urlencoded, otherwise you can use Content-Type: application/json.

over 4 years ago · Santiago Trujillo 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!