Fail while trying to access UBER API - Unprocessable Entity

32 views
Skip to first unread message

JayKay

unread,
Aug 26, 2016, 7:55:02 PM8/26/16
to AngularJS
Hi @all,

I'm just starting with Angular and as a first goal I thought it would make sense to realise the following userstory:

AS a user I want to see available UBER services in a certain location

Thus I already registered a UBER Dev-Account and obtained a Server Token and set up a minimum script to get started.
Currently I'm stuck with the error "GET https://api.uber.com/v1/products 422 (Unprocessable Entity)".

Some great idea anybody? Am I on the completely wrong track? :)

Thank you very much,
Jay

The Code:

<!DOCTYPE html>
<html>
<script>

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
    
    $http({
        latitude:37.775818,
        longitude:-122.418028,
        headers: {
    Authorization:'token >>here goes the Server Token<<'
    }
    }).then(function(response) {
        $scope.uberresponse = response.data;
    });
});
</script>

<body>

<div ng-app="myApp" ng-controller="myCtrl"> 

<p>Uber response:</p>
<pre>{{uberresponse}}</pre>

</div>


</body>
</html>



Reply all
Reply to author
Forward
0 new messages