mythic
mythic

Reputation: 935

How to use an open source API in Visual Studio 2015

I'm trying to develop an Universal Windows Platform app (aimed primarily for phones, but it has to work on UWP, so on a PC/tablet too). I can use C#, XAML, HTML and JS(WinJS).

The app I'm working on will show the user local/city bus depending on the chosen line/stop. I've found a great API that I am allowed to use. It returns HTML by default or JSON if you use a certain parameter.

The thing is I don't know how to use the API. There's a short documentation about it, but I don't know how to actually use it.

There's a GET (command?) /station/bus that returns arrivals of chosen buses for a certain station. I understand that part, but I have no idea how to actually do that in Visual studio. Any tips/references/guide would be helpful.

I can link you the documentation if necessary, but it isn't entirely in English.

Upvotes: 0

Views: 1142

Answers (1)

Hannes Nel
Hannes Nel

Reputation: 532

This is what is commonly called a REST api. You can consume REST api's by doing http requests to the endpoint that they provide, using an HttpClient object. This article here details how to do it in a Windows 8 app. The process in a Windows 10 UWP is pretty much the same.

The documentation here shows how to use the HttpClient in Windows 10 apps to get data out of their API. You'll want to get the JSON data, not the html. You can then parse the JSON data to a dynamic object to easily work with it.

Upvotes: 4

Related Questions