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
JavaBot
JavaBot14mo ago
This post has been reserved for your question.
Hey @Danix! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP14mo ago
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
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP14mo ago
so to make a call from online api's should i have to learn the Spring boot
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP14mo ago
So do u have any documentation or any tutorial to learn about http client
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP14mo ago
Hmm
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP14mo ago
I wanna make a simple weather application from java that's the reason I want to learn http client
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP14mo ago
Ohh ok ok Thanks
JavaBot
JavaBot14mo ago
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
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP14mo ago
Before learning the http client?
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
JavaBot
JavaBot14mo ago
💤 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.
tjoener
tjoener14mo ago
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
tjoener
tjoener14mo ago
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 ofc
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
tjoener
tjoener14mo ago
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
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
tjoener
tjoener14mo ago
Does it use dates anywhere?
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
tjoener
tjoener14mo ago
ah, because there's jackson-datatype-jdk8 if you need jdk8 types
tjoener
tjoener14mo ago
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,...
tjoener
tjoener14mo ago
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
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
tjoener
tjoener14mo ago
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
JavaBot
JavaBot14mo ago
💤 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.

Did you find this page helpful?