API integration from Java with Jersey Client

Required maven

The following three are required

           <groupId>org.glassfish.jersey.core</groupId>
           <artifactId>jersey-client</artifactId>
           <version>2.27</version>
       
           <groupId>org.glassfish.jersey.media</groupId>
           <artifactId>jersey-media-json-jackson</artifactId>
           <version>2.26</version>
       
           <groupId>org.glassfish.jersey.inject</groupId>
           <artifactId>jersey-hk2</artifactId>
           <version>2.26</version>
  

Not enough

java.lang.ClassNotFoundException: org.glassfish.jersey.internal.l10n.LocalizableMessageFactory$ResourceBundleSupplier

I don't understand this error

Implementation: Works with POST

✩ I want to call the API of http: // localhost: 8080 / test / api1

public void excute(RequestData req) {
		
		String result = ClientBuilder.newClient()
				//URL with fixed cooperation destination
				.target("http://localhost:8080")
				//Where the path changes depending on the link destination
				.path("/test/api1")
				//Where to decide whether to request in Xml format or JSON format
                //Specify this for xml → APPLICATION_XML_TYPE
				.request(MediaType.APPLICATION_JSON_TYPE)
				//Data plunge
                //Specify in what format to receive the response with MediaType This time JSON
				.post(Entity.entity(req, MediaType.APPLICATION_JSON), String.class);

		//Display response on standard output
		System.out.println(result);

	}

Recommended Posts

API integration from Java with Jersey Client
Sample of using Salesforce's Bulk API from Java client with PK-chunking
Play with Jersey OAuth 2 client
[Java EE] Implement Client with WebSocket
Code Java from Emacs with Eclim
Java HTTP Client API timeout setting
Work with Google Sheets from Java
[Java] LINE integration with Spring Boot
Call TensorFlow Java API from Scala
SetCookie from the client side with OkHttp3
Data processing using stream API from Java 8
Call GitHub API from Java Socket API part2
[MarkLogic] CRUD + α by "Java Client API"
Hit the Salesforce REST API from Java
Getting Started with Java Starting from 0 Part 1
When calling API with java, javax.net.ssl.SSLHandshakeException occurs
Execute Java code from cpp with cocos2dx
[Java] Get Json from URL and handle it with standard API (javax.script)
Sample code to call Yahoo! Shopping Product Search (v3) API with HTTP Client API officially introduced from Java 11
Interact with LINE Message API using Lambda (Java)
Run Rust from Java with JNA (Java Native Access)
[Java] Set the time from the browser with jsoup
Java Stream API
Text extraction in Java from PDF with pdfbox-2.0.8
How to use Java API with lambda expression
Use Matplotlib from Java or Scala with Matplotlib4j
[Java] Get images with Google Custom Search API
Java mqtt client
Docker Container Operations with Docker-Client API for Java
Generate Java client code for Salesforce SOAP API
Call a method with a Kotlin callback block from Java
Implement API client with only annotations using Feign (OpenFeign)
[Note] Create a java environment from scratch with docker
Read temperature / humidity with Java from Raspberry Pi 3 & DHT11
Install java with Homebrew
Call Java from JRuby
Compatible with Android 10 (API 29)
Changes from Java 8 to Java 11
Sum from Java_1 to 100
Pack API response (java)
Change seats with java
Install Java with Ansible
[Java] Stream API / map
Eval Java source from Java
Docker-Client Java API Troubleshooting
Comfortable download with JAVA
Access API.AI from Java
Switch java with direnv
Java8 Stream API practice
From Java to Ruby !!
Zabbix API in Java
Download Java with Ansible
Let's scrape with Java! !!
How to develop an app with Jersey Java RESTful API on Alibaba Cloud ECS instance
Build Java with Wercker
Endian conversion with JAVA
Let's write how to make API with SpringBoot + Docker from 0
Find the address class and address type from the IP address with Java
Handle Java 8 date and time API with Thymeleaf with Spring Boot
[MT] Specify the article category from Android with Data API
[Java] Get Charset with Apathce Tika / Initialize String from Charset [Kotlin]