404 error using api for create new user

prabhu7 years ago

hi
I am creating new interface web client with angular js.
I am using the traccar api to add new user.
I am getting 404 error

attached is the screenshot of the error - http://imgur.com/a/x7T9M

kindly check and advice

prabhu7 years ago

this my controller code

.state('admin.addvendor', {
            url: '/add_vendors',
            templateUrl: 'tpl/admin/addvendor.html',
            controller: function($rootScope, $scope, url) {
                $rootScope.currentState = "admin.addvendor";
                $scope.vendor = {
                      "email": "oldmail@mydomain.com",
                      "name": "new_user",
                      "password": "NEWPASSWORD"
                    };
                $('#datetimepicker1').datetimepicker();

                
                    console.log($scope.vendor);

                    $rootScope.req(url + 'users', "POST",{ body: $scope.vendor }, function (resp) {
                        //console.log(resp);
                    }, null, true, { 'Content-Type': 'application/json'});
                
            }
        })
Anton Tananaev7 years ago

Can I see the network request, including headers and body.

prabhu7 years ago
angular.module('traccar-web-ng', ['ui.router', 'cgNotify', 'ngWebSocket', 'ngMap'])

  .constant('url', "http://gps.cobrasoftwares.in:8082/api/")
prabhu7 years ago
<div class="divider-50"></div>
<h3 align="center">Vendors Management</h3>
<div class="divider-50"></div>
<div class="row">
  <div class="col-md-6 col-md-offset-3">
    <form name="addvendorform" novalidate>
      <div class="panel panel-default">
        <div class="panel-heading">
          <h1 class="panel-title" align="center">Add New Vendor</h1>
        </div>
        <div class="panel-body">
          <div class="col-md-12 col-sm-12 col-lg-12" class="form-horizontal">
            <div class="form-group">
              <label class="col-sm-4 control-label">Name</label>
              <div class="col-sm-8">
                <input type="text" required class="form-control" ng-model="vendor.name">
              </div>
            </div>
            <br>
            <br>
            <div class="form-group">
              <label class="col-sm-4 control-label">Email ID</label>
              <div class="col-sm-8">
                <input type="email" required class="form-control" ng-model="vendor.email">
              </div>
            </div>
            <br>
            <br>
            <div class="form-group">
              <label class="col-sm-4 control-label">Password</label>
              <div class="col-sm-8">
                <input type="password" required class="form-control" ng-model="vendor.password">
              </div>
            </div>
            <br>
            <br>
            <div class="form-group">
              <label class="col-sm-4 control-label">Admin</label>
              <div class="col-sm-8">
                <input type="checkbox" value="true" ng-model="vendor.admin">
              </div>
            </div>
            <br>
            <br>
            <div class="form-group">
              <label class="col-sm-4 control-label">Expiration Date</label>
              <div class="col-sm-8">
                <input class="form-control" type="text" ng-model="vendor.expirationTime" id="datetimepicker1" data-date-format="yyyy-mm-ddThh:ii:ss">
              </div>
            </div>
          </div>
        </div>
        <div class="panel-footer" align="right">
          <button class="btn-danger btn btn-md" ng-click="addvehicle = {}" tabindex="-1">Clear</button>
          <button type="submit" class="btn-primary btn btn-md" ng-disabled="addvendorform.$invalid" ng-click="submit()">Save</button>
        </div>
      </div>
    </form>
  </div>
</div>
Anton Tananaev7 years ago

Not sure why you are copy-pasting code here. I need to see actual network request. The easiest way to see it, is through browser developer tools.

prabhu7 years ago
Anton Tananaev7 years ago

As I said before, I need to see both headers and body.

prabhu7 years ago
Anton Tananaev7 years ago

I don't see any difference with previous screenshot. If you want help, please provide BODY of the request and response.