mardi 12 mai 2015

HTTP Status 415 - Unsupported Media Type when doing POST

So I was trying to do a POST using REST with Postman in Chrome, but after I hit send got error

HTTP Status 415 - Unsupported Media Type

My code and part of the screen shot is included, the pair for the hashmap I tried is duration and 150. I am sure the URL is correct but don't know why the media type is not accepted.

@Path("activities")
public class ActivityResource {

    @POST
    @Path("activity")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
    public Activity createActivityParams(MultivaluedHashMap<String,String> formParams){
        return null;
    }
}

enter image description here

enter image description here

Aucun commentaire:

Enregistrer un commentaire