Mapbox Directions API returns unusable response with status code 422
<p>I am using MapBox Directions with android and I'm trying to just get the directions to later draw on the map. </p>

<p>However, the response I get from the call is never usable as the response.body() returns null. </p>

<p>When I call response.code() i get the status code <strong>422</strong>, which according to the Mapbox API means "The given request was not valid. The  message key of the response will hold an explanation of the invalid input."</p>

<p>The response.message() returns the string "Unknown". </p>

<p>response.errorBody() returns the string "okhttp3.ResponseBody$1@38fb6f04"</p>

<p>I have used the same code as <a href="https://stackoverflow.com/questions/37149805/mapbox-android-how-to-get-directions-from-current-location-to-a-destination-you">this stack overflow answer</a> which should work, but it doesn't. Any help would be appreciated. </p>

<p>Heres my method: </p>

<pre><code>    private void getRoute(Position origin, Position destination) throws ServicesException {

    MapboxDirections client = new MapboxDirections.Builder()
            .setOrigin(origin)
            .setDestination(destination)
            .setProfile(DirectionsCriteria.PROFILE_CYCLING)
            .setAccessToken("Same access token as the map uses")
            .build();

    client.enqueueCall(new Callback&lt;DirectionsResponse&gt;() {
        @Override
        public void onResponse(Call&lt;DirectionsResponse&gt; call, Response&lt;DirectionsResponse&gt; response) {
            // You can get the generic HTTP info about the response
            Log.d(TAG, "Response code: " + response.code());
            if (response.body() == null) {
                Log.e(TAG, "No routes found, make sure you set the right user and access token.");
                return;
            }

            // Print some info about the route
            currentRoute = response.body().getRoutes().get(0);
            Log.d(TAG, "Distance: " + currentRoute.getDistance());
            Toast.makeText(MainActivity.this, "Route is " +  currentRoute.getDistance() + " meters long.", Toast.LENGTH_SHORT).show();

            // Draw the route on the map
            drawRoute(currentRoute);
        }

        @Override
        public void onFailure(Call&lt;DirectionsResponse&gt; call, Throwable t) {
            Log.e(TAG, "Error: " + t.getMessage());
            Toast.makeText(MainActivity.this, "Error: " + t.getMessage(), Toast.LENGTH_SHORT).show();
        }
    });
}
</code></pre>

<p>And my imports: </p>

<pre><code>import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import com.mapbox.services.directions.v5.DirectionsCriteria;
import com.mapbox.services.directions.v5.MapboxDirections;
import com.mapbox.services.directions.v5.models.DirectionsResponse;
import com.mapbox.services.directions.v5.models.DirectionsRoute;
</code></pre>

<p>And my gradle: </p>

<pre><code>    compile ('com.mapbox.mapboxsdk:mapbox-android-services:1.0.0@aar'){
    transitive=true
}
</code></pre>

<p>I have tried with different positions in different countries with the as well as a new access token with ass permissions turned on with the same results. What am I doing wrong? </p>

<p>Thanks a lot. </p>