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

154
Views
Bad Request error in uber api

I've been trying to get the uber price estimates endpoint working, but I'm stuck on an error that leads me to a blank page saying, "Bad Request." The console also says "callback not a function" but I can't seem to find out what is wrong.

My route:

//  Get an upfront fare before requesting a ride
app.get('/v1.2/estimates/price', function(request, response) {
    // extract the query from the request URL
    var query = request.query;

    // if no query params sent, respond with Bad Request
    if (!query || !query.lat || !query.lng) {
      response.sendStatus(400);
    } else { 
          uber.estimates.getPriceForRouteAsync( {
              "product_id": "33de8094-3dc4-4ca9-8f67-243275f57623", 
              "start_latitude": "38.9597897", 
              "start_longitude": "-94.60699369999999",
              "end_latitude": "39.010969", 
              "end_longitude": "-94.61509899999999"
          })
          .then(function(res) {
              log(res);
          })
          .error(function(err) {
              console.error(err);
          });
    }
});

Any help is appreciated.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Please check out the README for node-uber. The method does not take a JSON object but the arguments in the method call:

uber.estimates.getPriceForRouteAsync(38.9597897, -94.606994, 39.010969, -94.615098) .then(function(res) { console.log(res); }) .error(function(err) { console.error(err); });

Also, the product ID is not needed as the /estimates/price endpoint returns an array of estimates for each product.

about 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!