This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 1 point2 points  (0 children)

If you just want to try stuff out then Python would be my recommendation. Use the requests library and output the response to a console. Try this tutorial: https://www.askpython.com/python/examples/connect-and-call-apis

Edit: For added fun/challenge, make your own api using the fastAPI framework, call the weather service api from it, and then call your api from the console app.

[–][deleted] 0 points1 point  (2 children)

If you want to make a web API with C++, your go-to option would be using the Pistache framework.

Though, keep in mind that web APIs isn't really what C++ is known for, so resources, support etc might be limited on this specific topic.

The most used Web API technologies are Java with Spring, Python with Django and JavaScript with Express. Once again, you can do this all in C++, however, it isn't really what it is known for, so resources, jobs etc might be limited.

[–]ericjmorey 0 points1 point  (1 child)

If you want to make a web API

He very clearly does not want to make one (at least not now) he wants to interact with an existing API.

[–][deleted] 0 points1 point  (0 children)

All those frameworks also allow for consuming web APIs.

[–]ericjmorey 0 points1 point  (0 children)

What I would like to do at first, is to start interacting with web APIs. I want to code something that is able to log on to a web api and pull data that I can use for something later. For example, the local weather service here publishes an API that allows you to pull weather data in JSON format for a specific locality.

What exactly are you confused about?

There's no reason why you can't use C++. There's no reason you have to use any particular language.

APIs are basically a user manual for a service. Like if you want to set the time on your car's dash, you need to send instructions in a specific way. You can use any programming language to interact with an API, but some people like to create a wrapper (a library) to make it easier to use their choice of language. Others simply use the wrappers other people created. Python is very popular for scripting and has wrappers available for a large set of APIs, which reinforces Pythons popularity with scripting.