简体   繁体   中英

Receive weather api data from services like Openweathermap

I need help getting started with getting information using API services like Openweathermap . What a good method to received and parse the information from the http request ? Thank you

I suggest you to follow a few tutorials about consuming (REST) API's.

Here are a few:

  1. https://spring.io/guides/gs/consuming-rest-jquery/ (jQuery)

  2. https://www.taniarascia.com/how-to-connect-to-an-api-with-javascript/

  3. http://g-liu.com/blog/2016/07/a-strategy-for-consuming-rest-apis-in-javascript/

========================================================================

a good method to get started is experimenting with the API without writing any code. This allows you to learn what the API does, how it works without losing time on coding.

postman will allow you to do this. If you don't know what you need to test/try out, i recommend @tijn167 's answer.

After experimenting in postman, it can also generate the code that you can then copy-paste into your program to recuperate some time lost experimenting

Kind of depends if you want to display it on the page via client side code or have your server get the data and put the values into an XPages control. What was suggested above was client side JS. You could also write Java that gets the data and uses GSON to bring into a Java object and then use that in an XPages control (repeat maybe?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM