Open API vs. REST API – difference

REST (REpresentational State Transfer) describes a way how a clients and servers interact with each other. REST communication typically bases on HTTP protocol (but that isn’t a requirement) and requests are made to a resource URI, possibly containing additional request data, and replies can be anything: HTML, XML, JSON, CSV, plain-text or even raw binary … Read more

SPRING REST: The request was rejected because no multipart boundary was found

The problem isn’t in your code – it’s in your request. You’re missing boundary in your multipart request. As it said in specification: The Content-Type field for multipart entities requires one parameter, “boundary”, which is used to specify the encapsulation boundary. The encapsulation boundary is defined as a line consisting entirely of two hyphen characters … Read more

Unable to get a generic ResponseEntity where T is a generic class “SomeClass”

This was a known issue. Now it’s fixed with the introduction of ParameterizedTypeReference, which is a parameterized type that you explicitely inherit to supply type information at runtime. This is called a super-type token, and works around type erasure because subclasses (anoniymous in this case) keep the type arguments of the generic supertype at runtime. … Read more

Node.js REST API versioning the right way?

Instead of adding version in every route you can add it in app level. So It won’t be tightly coupled with API route. import * as express from ‘express’; // v1/get-ride.js const router = express.Router(); router.post(‘/rides/:id’, dep.verifyToken(), (req, res) => { // Your code }); app.use(‘/v1’, router); // v2/get-ride.js const router = express.Router(); router.post(‘/rides/:id’, dep.verifyToken(), … Read more

Rest vs Wcf pros and cons [closed]

Rest is a way of doing communication over the internet. It is a very basic process of picking addresses to serve as method locations and returning HTML standard data (javascript, css, html of course). WCF is a .net library used to have two programs talk to each other using SOAP. Which consists of two very … Read more

Rest – how get IP address of caller

Inject a HttpServletRequest into your Rest Service as such: import javax.servlet.http.HttpServletRequest; @GET @Path(“/yourservice”) @Produces(“text/xml”) public String activate(@Context HttpServletRequest req,@Context SecurityContext context){ String ipAddressRequestCameFrom = requestContext.getRemoteAddr(); // header name is case insensitive String xForwardedForIP = req.getHeader(“X-Forwarded-For”); // if xForwardedForIP is populated use it, else return ipAddressRequestCameFrom String ip = xForwardedForIP != null ? xForwardedForIP : ipAddressRequestCameFrom; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)