{"id":28604033,"url":"https://github.com/uber/rides-java-sdk","last_synced_at":"2026-04-02T02:44:23.265Z","repository":{"id":50476547,"uuid":"42742666","full_name":"uber/rides-java-sdk","owner":"uber","description":"Uber Rides Java SDK (beta)","archived":false,"fork":false,"pushed_at":"2023-12-04T21:03:12.000Z","size":549,"stargazers_count":103,"open_issues_count":11,"forks_count":57,"subscribers_count":2563,"default_branch":"master","last_synced_at":"2024-05-09T07:59:17.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://developer.uber.com/docs","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uber.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-09-18T19:20:11.000Z","updated_at":"2024-05-02T18:20:45.000Z","dependencies_parsed_at":"2023-12-04T20:24:51.013Z","dependency_job_id":"f16228bc-a030-4130-808c-1f3743ac4216","html_url":"https://github.com/uber/rides-java-sdk","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/uber/rides-java-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Frides-java-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Frides-java-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Frides-java-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Frides-java-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uber","download_url":"https://codeload.github.com/uber/rides-java-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Frides-java-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259308163,"owners_count":22837974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T17:40:11.948Z","updated_at":"2026-04-02T02:44:23.234Z","avatar_url":"https://github.com/uber.png","language":"Java","readme":"# Uber Rides Java SDK (Beta) [![Build Status](https://travis-ci.org/uber/rides-java-sdk.svg?branch=master)](https://travis-ci.org/uber/rides-java-sdk)\nThis SDK helps your Java App make HTTP requests to the Uber Rides API.\n\n## Setup\n\n### Installing\n\n#### Before you begin\nRegister your app in the [Uber developer dashboard](https://developer.uber.com/dashboard). Notice that the app gets a client ID, secret, and server token required for authenticating with the API. \n\nNote: Using Android? Be sure to checkout the [Uber Android SDK](github.com/uber/rides-android-sdk) in addition, which has native authentication mechanisms.\n\n#### Gradle\n\nUber Rides SDK:\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.uber.sdk/uber-rides.svg)](https://mvnrepository.com/artifact/com.uber.sdk/uber-rides)\n\n```gradle\ndependencies {\n    compile 'com.uber.sdk:uber-rides:x.y.z'\n}\n```\n\nUber Oauth Client Adapter:\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.uber.sdk/uber-core-oauth-client-adapter.svg)](https://mvnrepository.com/artifact/com.uber.sdk/uber-core-oauth-client-adapter)\n\n```gradle\ndependencies {\n    compile 'com.uber.sdk:uber-core-oauth-client-adapter:x.y.z'\n}\n```\n\n#### Maven\n\nUber Rides SDK:\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.uber.sdk/uber-rides.svg)](https://mvnrepository.com/artifact/com.uber.sdk/uber-rides)\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.uber.sdk\u003c/groupId\u003e\n  \u003cartifactId\u003euber-rides\u003c/artifactId\u003e\n  \u003cversion\u003ex.y.z\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nUber Oauth Client Adapter:\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.uber.sdk/uber-core-oauth-client-adapter.svg)](https://mvnrepository.com/artifact/com.uber.sdk/uber-core-oauth-client-adapter)\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.uber.sdk\u003c/groupId\u003e\n  \u003cartifactId\u003euber-core-oauth-client-adapter\u003c/artifactId\u003e\n  \u003cversion\u003ex.y.z\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Authenticating and creating a session\nTo make calls, you need to create an authenticated session with the API. While operations on behalf of users require a user-authorized token using OAuth 2, general requests can use server-token authentication.\n\n\n#### Create a session using a server token\n```java\n// Get the server token for your app from the developer dashboard.\nSessionConfiguration config = new SessionConfiguration.Builder()\n    .setClientId(\"YOUR_CLIENT_ID\")\n    .setServerToken(\"YOUR_SERVER_TOKEN\")\n    .build();\n\nServerTokenSession session = new ServerTokenSession(config));\n```\n#### Create a session using the OAuth 2 flow\nIn an OAuth session, the app first asks the user to authorize and then exchanges the authorization code for an access token from Uber.\nNote: Make sure the redirect URI matches the callback URI in the developer dashboard for the app. \n\n**Step 1**. Create an OAuth2Credentials object with your client ID, client secret, scopes, and a redirect callback URI to capture the user’s authorization code.\n```java\nSessionConfiguration config = new SessionConfiguration.Builder()\n    .setClientId(\"YOUR_CLIENT_ID\")\n    .setClientSecret(\"YOUR_CLIENT_SECRET\")\n    .setScopes(yourScopes)\n    .setRedirectUri(redirectUri)\n    .build();\n    \nOAuth2Credentials credentials = new OAuth2Credentials.Builder()\n    .setSessionConfiguration(config)\n    .build();\n    \n```\n**Step 2**. Navigate the user to the authorization URL from the OAuth2Credentials object. \n```java\nString authorizationUrl = credentials.getAuthorizationUrl();\n```  \n**Step 3**. Once the user approves the request, you get an authorization code. Create a credential object to store the authorization code and the user ID.\n```java\nCredential credential = credentials.authenticate(authorizationCode, userId);\n```\n**Step 4**. Create a session object using the credential object.\n```java\nCredentialsSession session = new CredentialsSession(config, credential)\n```\n**Step 5**. Instantiate a service using a session to start making calls.\n```java\nRidesService service = UberRidesApi.with(session).createService();\n```\nNote: Keep each user's access token in a secure data store. Reuse the same token to make API calls on behalf of your user without repeating the authorization flow each time they visit your app. The SDK handles the token refresh automatically when it makes API requests with an `UberRidesService`.\n\n## Sync vs. Async Calls\nBoth synchronous and asynchronous calls work with the Uber rides Java SDK. The networking stack for the Uber SDK is powered by [Retrofit 2](https://github.com/square/retrofit) and the same model of threading is available.\n\n#### Sync\n```java\nResponse\u003cUserProfile\u003e response = service.getUserProfile().execute();\nif (response.isSuccessful()) {\n    //Success\n    UserProfile profile = response.body();\n} else {\n    //Failure\n    ApiError error = ErrorParser.parseError(response);\n}\n\n```\n\n#### Async\n```java\nservice.getUserProfile().enqueue(new Callback\u003cUserProfile\u003e() {\n    @Override\n    public void onResponse(Call\u003cUserProfile\u003e call, Response\u003cUserProfile\u003e response) {\n        if (response.isSuccessful()) {\n            //Success\n            UserProfile profile = response.body();\n        } else {\n            //Api Failure\n            ApiError error = ErrorParser.parseError(response);\n        }\n    }\n\n    @Override\n    public void onFailure(Call\u003cUserProfile\u003e call, Throwable t) {\n        //Network Failure\n    }\n});\n```\n\n\n## Samples for Common Calls\nUse the Java classes in the [samples](https://github.com/uber/rides-java-sdk/tree/master/samples/cmdline-sample) folder to test standard requests. Alternatively, you can download a sample from the [releases page](https://github.com/uber/rides-java-sdk/releases) to try them out.\n\nFor full documentation, visit our [Developer Site](https://developer.uber.com/v1/endpoints/).\n\n### Get available products\n```java\n// Get a list of products for a specific location in GPS coordinates, example: 37.79f, -122.39f.\nResponse\u003cList\u003cProduct\u003e\u003e response = service.getProducts(37.79f, -122.39f).execute();\nList\u003cProduct\u003e products = response.body();\nString productId = products.get(0).getProductId();\n```\n\n### Request a ride\n```java\n// Request an Uber ride by giving the GPS coordinates for pickup and drop-off.\nRideRequestParameters rideRequestParameters = new RideRequestParameters.Builder().setPickupCoordinates(37.77f, -122.41f)\n       .setProductId(productId)\n       .setDropoffCoordinates(37.49f, -122.41f)\n       .build();\nRide ride = service.requestRide(rideRequestParameters).execute().body();\nString rideId = ride.getRideId();\n```\n**Warning**: This real-world request can send an Uber driver to the specified start location. To develop\nand test against endpoints in a sandbox environment, instantiate your `UberRidesService` with a `Session` whose `Environment` is set to `SANDBOX`.\nThis will take an existing session and generate a new one pointing to `SANDBOX`.\n```java\n\nSessionConfiguration config = existingConfig.newBuilder().setEnvironment(Environment.SANDBOX).build()\n\nCredentialsSession session = new CredentialsSession(config, credential));\nRidesService service = UberRidesApi.with(session);\n```\nSee our [documentation](https://developer.uber.com/docs/riders/guides/sandbox) to learn more about the sandbox environment.\n\n### Update a ride in the sandbox\nIf you request a ride in the sandbox, you can step through the different states of the ride.\n```java\nSandboxRideRequestParameters rideParameters = new SandboxRideRequestParameters.Builder().setStatus(“accepted”).build();\nResponse\u003cVoid\u003e response = service.updateSandboxRide(rideId, rideParameters).execute();\n```\nA successful update returns a 204 for `response.code()`.\n\nNote: The `updateSandboxRide` method is not valid in the `PRODUCTION` `Environment`, where the ride status changes automatically. In a `PRODUCTION` `Environment`, the call will fail.\n\n## Getting Help\nUber developers actively monitor the [uber-api tag](http://stackoverflow.com/questions/tagged/uber-api) on StackOverflow. If you need help installing or using the library, ask a question there. Make sure to tag your question with `uber-api` and `java`!\n\n## Migrating from a previous version\nAs the Uber SDK get closer to a 1.0 release, the API's will become more stable. In the meantime, be sure to check out the changelog to know what differs!\n\n## Contributing\nWe :heart: contributions. If you find a bug in the library or would like to add new features, go ahead and open\nissues or pull requests against this repo. Before you do so, please sign the\n[Uber CLA](https://docs.google.com/a/uber.com/forms/d/1pAwS_-dA1KhPlfxzYLBqK6rsSWwRwH95OCCZrcsY5rk/viewform).\nAlso, be sure to write a test for your bug fix or feature to show that it works as expected.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Frides-java-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber%2Frides-java-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Frides-java-sdk/lists"}