I've previously used Square's Retrofit successfully for a @GET
web API call but when trying to send JSON as the @BODY
in a @POST
call, on the server (Rails) the JSON is showing up as Parameters rather than the body request.
My understanding is that @BODY
will add that method parameter to the request in the body.
Any idea what I'm doing wrong?
WebApi:
@POST("/api/v1/gear/scans.json")
Response postScans(
@Header(HEADER_AUTH) String token,
@Body JsonObject scans
);
Make web request:
RestAdapter restAdapter = new RestAdapter.Builder()
.setServer(api_url)
.build();
WebApi webApi = restAdapter.create(AssetsWebApi.class);
Response response = webApi.postScans(auth_token, valid_json);