How To Call a Rest API In Java
I wanna Know Which Topic I have to Learn to understand that how to call a restful APIs in java and if u have any site for that topic so please suggest me ..
32 Replies
⌛
This post has been reserved for your question.
Hey @Danix! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
I have learned java core recently and now I want to make weather application for which I have to learn that how to fetch data from restful APIs that are already available online and how to write the code in java to get the data..
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
so to make a call from online api's should i have to learn the Spring boot
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
So do u have any documentation or any tutorial to learn about http client
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
Hmm
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
I wanna make a simple weather application from java that's the reason I want to learn http client
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
Ohh ok ok
Thanks
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
Before learning the http client?
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Java 11 has https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html
Stop using libraries for standard library stuff
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
Map.computeIfAbsent(__ -> new <Collection>()).add(...)
Multimap 😄
Collection can be any collection you like
And Map shoudl be defined as
Map<K, Collection<V>>
Since 11 I don't use Guava anymore
If you're making a library to do something that might be useful to other people, please do remove as many dependencies as you can. Especially all the utility stuff like guava or http client libraries etc
Depends on how hard you're set on targeting Java 8 ofcUnknown User•14mo ago
Message Not Public
Sign In & Join Server To View
well, just stick with junit-jupiter
junit junit is the old version
so that can be removed
And the default seems to be trending towards slf4j, so maybe use slf4j-api instead of log4j-api
https://mvnrepository.com/open-source/logging-frameworks
jackson is probably a good default choice, are you writing a http client library? Like an SDK of sorts?
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
Does it use dates anywhere?
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
ah, because there's jackson-datatype-jdk8 if you need jdk8 types
GitHub
GitHub - FasterXML/jackson-modules-java8: Set of support modules fo...
Set of support modules for Java 8 datatypes (Optionals, date/time) and features (parameter names) - GitHub - FasterXML/jackson-modules-java8: Set of support modules for Java 8 datatypes (Optionals,...
You don't need them if you don't use those types
But I come across http client sdks that still use java util Date sometimes 🙂
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
If you actually looked at the screenshot you'd have seen he uses log4j-API, which isn't an implementation, hence why I suggested to use slf4j-api
Pretty sure you don't have to fully specify the resources plugin. Theres a shorthand if you just want to enable filtering
OK, so much of this is wrong:
log4j is for logging stuff urself
org.apache.logging.log4j:log4j-core
is the actual implementation
they are not interchangable..... slf4j is an protocol
org.apache.logging.log4j:log4j-api
, which he's using is as well
and log4j is an implementation (of slf4j - btw) .....No it isn't, to bridge those two you need either
org.apache.logging.log4j:log4j-slf4j-impl
if you're using log4j as your implementation, or org.slf4j:log4j-over-slf4j
if using slf4j, which would either be slf4j-simple or logback classic💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.