I tried to send SMS using restcomm http api, it was successful when sent with Media_Type="application/x-www-form-urlencoded" from SOAPUI.
But while trying it with "application/json" it throws following error
01:00:22,439 SEVERE [com.sun.jersey.spi.container.ContainerRequest] (http-/127.0.0.1:8080-1) A message body reader for Java class javax.ws.rs.core.MultivaluedMap, and Java type javax.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.String>, and MIME media type application/json was not found.
The registered message body readers compatible with the MIME media type are:
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
com.sun.jersey.core.impl.provider.entity.EntityHolderReader
From documents it look like only Response could be XML or JSON.
Two Questions:-
Thanks for your question Imran,
Answer to your first question is that, twilio came first and defined the api, we, in order to try to be compatible with them, adopted the same api approach. We can say it is not as per core principles of rest/http
but one can say it is easier for a web developer to put .json
instead of playing with headers but that a different debate. I hope I already covered reason to use URL approach.
For second question, it makes sense to support json requests. (Would you like to open a github issue for that, would you be interested to contribute on it.)