Anyone use Yahoo Finance API?

I’m a little confused about how to use the Yahoo Finance API. I get that it’s a RESTful API, and I kinda get the basics for that, but how can I implement it into my app? There are a variety of endpoints, but I’m more confused about how to import the JSON data into my app. How do I construct the URL for reference in XCode?

Just for reference, I have tried AlphaVantage, and that seems to work OK, as I found their documentation more straight forward, but I would rather use Yahoo Finance.

Thanks fro your help!

Have you followed through this tutorial? It’ll help with figuring out how to parse the JSON, I’m not sure specifically about the Yahoo Finance API though

Thanks for the reply! Sorry I wasn’t aware of it.

They had some sample code suggested for swift, but I wasn’t sure of it was the best way to do it. Also, I wasn’t familiar with NSMutable, so I’ll look at this and the tutorial.

The parsing went well, so thanks for the advice and video.

However, I was confused on how to interpret and use the “NSMutableURLRequest” I had previous only used regular URL objects, like Chris has done in his tutorials which I have followed. Is there a way to convert these NSMutableURLRequests to URL objects, while still maintaining all the other info, such as headers and parameters?

Thanks for the help!

Sorry for reopening the thread, but I have really been struggling with this API over the last couple of days. For some reason, whenever I try to give a value to the url, it returns nil. I initially used the URL(string: string) method, which from what I understand is not the most robust way to enter a url, but even after I swapped to using URLComponents, my url object kept returning nil.

Here is the screenshot of my code:

and a link to the documentation page for the API: https://rapidapi.com/apidojo/api/yahoo-finance1?endpoint=apiendpoint_aeccfc9c-66eb-4f4a-abf5-c14d952e09f6

Please help!

Thanks for your time.