Use GraphQL with in existing spring boot rest api - spring

We have few existing rest apis written in spring boot to fetch different data in our project? Now we are exploring options to use GraphQL. But we don't want rest endpoints & response to change since it is being consumed by many UI/backend applications. Can anyone suggest proper way to use GraphQL within existing API without changing rest endpoints and Response type?

Related

How to consume REST API and SOAP endpoint using one rest API?

We have an application that uses both rest API and soap API. At a time we use either of them, but the requirement is to change it when needed. So, the question is there a way to use a single API that can handle REST and SOAP requests, so that we can use either of them depending on our condition in spring boot?
I have tried to call using single rest API. My expectation is to find a mechanism that can handle both soap and rest requests.

Spring Boot Reactive WebService

We want to build a rest API to service high request volumes. I'm planning to build it using Spring Reactive(WebFlux) or using Spring Boot Async. We have multiple different clients who will be invoking our service.
Do I need to worry about different clients who will be consuming this service? Meaning if I build the API using Reactive or Async, will all the clients be able to consume this seemlessly?
Meaning if build a reactive Rest API, will the client using RestTemplate be able to consume or do they need to use WebClient only?
Yes, your (not non blocking) clients will still be able to consume a reactive service.

mimic swagger api on spring boot application

I got a Spring boot REST based proxy server application with standard REST End point exposed(GET, POST,PUT and DELETE) to outside world.
Any requests coming from external world then will be routed to actual functionality internally.
Now the requirement is to expose all the API supported by my REST proxy server. As I mentioned I do not have static controller path in my code for individual APIs. So would like to get your input how to create swagger support for all the internal APIs that my proxy server support. Is there are a way I can generate swagger schema manually to mimics the controller path? Or is there any other way to solve this problem?
Thanks in advance.

how to make spring mvc functions available for rest calls

I have a spring mvc application which runs correctly,now another colleague wants to call the same functions from another application but he needs REST URL of my functions.
how is it possible to provide the same functionality through spring REST?
is it just with new annotations .please provide some resource to show me how to do it.
when server has a service, only legal clients which had any contracts with server can access it. And clients can use service by the way such as: use RestTemplate to get/post request to URL of service, and clients can get data as JSON, or XML type if you have an equivalent object as this image:
Also, a service can be support as a interface, ex: google search is a service supported by google, but it's not rest service.
If you know each other URL address you can consume each other REST API from java code by using RestTemplate object.
I would advise you to go over the Spring starter guide which deals with that issue, here is the link (Consuming a RESTful Web Service):
https://spring.io/guides/gs/consuming-rest/

Nested GraphQL servers / microservices

I would like to replace all my REST APIs with GraphQL (apollo-server preferred). It's clear to me how to use GraphQL in monolithic apps but it's not clear how to do it for microservices.
The main API server consists of multiple microservices where each microservice exposes its own REST API through which the central API server communicates with it. I would like to replace all these REST APIs with GraphQL thus I would get microservices as nested GraphQL servers communicating with each other through GraphQL instead of REST.
The problem that I'm facing is how to easily build a GraphQL query string for microservices based on the received attributes in the resolver of the main GraphQL server. There is no way to tell GraphQL to return all the fields for microservice. The best way would be to simple forward just a part of a the main query further to a microservice.
Any ideas? Do you think that REST is still more appropriate for microservices then GraphQL?
I can suggest you to use WAMP protocol and then build a network of all of your functionality.
Finally serve it under 1 GraphQL server

Resources