Skip to content
Advertisement

Tag: rest

Request working fine in postman, but getting a 403 in OkHTTP

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

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

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

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

Advertisement