You are here

How to Invoke the Uber API from the Server Using JavaScript,

Applying custom logic to an app is a great way to add to the feature-set to improve performance and UX. It can allow your app to provide more in-depth services, and implementing app logic is easier than ever.

As an example, in this tutorial,’s Head of Developer Relations Max Katz writes custom app logic in’s Server Code in the form of a script that invokes the Uber REST API to return the Uber products available in your area.

This simple JavaScript uses latitude and longitude coordinates as service inputs to the script. The author originally used a header parameter to invoke the API, but found a simpler, more elegant solution when inspecting the Uber documentation.

This new method uses a server token provided by Uber, simplifying the script, with a newly-created parameters object for all of the API’s inputs. The great thing about this implementation is that by writing the script in’s Server Code, you automatically created the API to invoke it, all in just a few minutes.

Be sure to read the next API Design article: How to Improve API Errors With Defensive Design

Original Article

Invoking Uber REST API From Server Code