Add Person - GeekBrainsCommunityofAlumni/Statistics GitHub Wiki

Add Person

  • URL: /person
  • Method: POST
  • URL Params: None
  • Data Params:
    • Requred: {name: "Navalniy"}
  • Success Response:
    • Code: 200
    • Content: {id: 3, name: "Navalniy"}
  • Error Response:
    • Code: 400
    • Content: {errorMessage: "Bad Request"}
    • Code: 409
    • Content: {errorMessage: "Person already exists"}
  • Simple Call:
    var newPerson = {name: "Navalniy"};
    $.ajax({
      url: "/person",
      type: "post",
      dataType: "json",
      data: newPerson,
      contentType: "application/json; charset=utf-8",
      success: function (person) {
        $("#id").html(person.id);
        $("#name").html(person.name);
        $("#rank").html(person.rank);
      }
    });
⚠️ **GitHub.com Fallback** ⚠️