I’m trying to make a request to the Genius API, but I’m running into some issues using OkHTTP. This is my small script I’m using to make the call: When I run this script, I get a 403 error: For reference, here is a picture of me making the same exact request with Postman, and it works: Any ideas on
Tag: rest
Jackson adds backslash in json
I’m building REST service on Jersey and using Jackson to produce JSON from java classes of my model. Model with absolutely simple values, I think this is the most typical case. But I get strange result: My expecting result: My source values of fields does NOT contains any special characters. These are simple words. There’re my Java classes. Entity: Class
How to create REST API with optional parameters?
I need to implement an API with these path params. Can the second and third params by optional? So the client need not pass these, but have to pass the first and last. If this is not possible, then is it recommended to rearrange the params in this way? How to provide the optional params? Answer You can match the
How to generate java client code for swagger REST API documentation
My scenario is the following. I have a swagger .json eg.: http://petstore.swagger.io/v2/swagger.json I want to use a generated java client for the REST API above, like: Expexted output: cica and the new pet is stored according to the REST API implmentation. I have successfully generated server stub for the petstore with the command: But this maven project code is a
java.lang.IllegalArgumentException: Parameter ‘directory’ is not a directory
I am trying to deploy a maven web application on my local wildfly machine. But I am getting this error: Answer It seems that at deploy time, the application is looking for a directory which has not been generated at package time thus the problem. When created in the target/lib then the deployment runs ok.
Spring Data Rest – Soft Delete
I’ve been using spring data rest without any problem but now I have a requirement that when a user performs a DELETE operation on a given entity i.e. DELETE /accounts/<id> I need to set a flag on the database marking that entity as deleted but i do want to keep the record. Basically this means that I need to do
Unable to create call adapter for class example.Simple
I am using retrofit 2.0.0-beta1 with SimpleXml. I want the retrieve a Simple (XML) resource from a REST service. Marshalling/Unmarshalling the Simple object with SimpleXML works fine. When using this code (converted form pre 2.0.0 code): Service: I get this exception: What am i missing? I know that wrapping the return type by a Call works. But I want the
Hibernate : self join confusion?
I have a category table.In which first 5 are main category and others are sub category. I need to fetch the sub categories of first 5 main category so i have found the sql query The query is joining the same table itself.and am getting the result given below Result How can i convert the SQL query to HQL and
Spring Rest Controller Return Specific Fields
I’ve been going through my head the best way to design a JSON API using Spring MVC. As we all know IO is expensive, and thus I don’t want to make the client make several API calls to get what they need. However at the same time I don’t necessarily want to return the kitchen sink. As an example I
creating spring rest services without using spring boot
I’ve followed the Getting Started tutorial on spring.io for building REEST services https://spring.io/guides/gs/rest-service/. The problem is that this tutorial only explain how to produce a standalone running jar with tomcat embedded using spring boot. Is there a way to create a project from scratch to produce a war to deploy for instance on an already existing tomcat instance? PS: I