8

I am trying to access my account in microsoft health api. I have followed the steps in order to access access token. What I am wandering is what is the final steps in order to get information of my account? I have several parameters defined, I have a redirect URI an access token, secret code, user id, scope. How can I use them in order to get access to my account data?

How can authenticate my account using the access token I received in previous steps, in order to get access to the API?

In the document there is the following example for a valid GET request:

GET /v1/me/Profile HTTP/1.1 
Authorization: bearer EwCoAvF0BAAUkWhN6f8bO0+=

What request should I have to perform. I am not sure that I understand the example. I am trying to do:

http://myurl.com/v1/me/Profile HTTP/1.1 
Authorization: bearer "access token"

However I am receiving a message

page not found

.

Jose Ramon
  • 5,572
  • 25
  • 76
  • 152
  • 1
    Take a look at the [Bex](https://github.com/ScottIsAFool/Bex) nuget package which nicely handles all of the functionality for connecting and communicating with the Microsoft Health API. It encapsulates all of the JSON data into objects you can easily use in your application. – James Croft Feb 12 '16 at 15:50
  • 1
    Hi, @JoseRamon it is you again. ;) I just check your profile and notice that you really like to post question with bounty (this is your 17-th). This time, all the best too! ;) – Ian Feb 20 '16 at 06:49

1 Answers1

8

Microsoft Health API

Is accessed via JSON Get requests, depending on the information you would do something like this

var url = "http://baseapiurl/v1/me/Activities";

using (var webClient = new System.Net.WebClient()) {
    var json = webClient.DownloadString(url);

    // This will give a response that can be parsed using a JSON library
}

Microsoft Health API

Victor Procure
  • 886
  • 1
  • 6
  • 17
  • Since I am not familiar with JSON get requests for now. I am trying to have acess to " http://baseapiurl/v1/me/Activities " from my browser, however I am getting from chrome this page is not available! – Jose Ramon Feb 12 '16 at 14:21
  • And how I perform the authentication with the access token here? Furthermore I am not sure, however in the url section I provided a navide url ( which is not an existant url). – Jose Ramon Feb 12 '16 at 14:27
  • You can use the Google Chrome extension: Postman to view REST responses. – Victor Procure Feb 12 '16 at 16:11
  • In order everything to be straight, http://baseapiurl/ is the url I have put when I create my account in Microsoft health, right? I have download the Postman Rest client. I can use directly your code, in pre-request script? Sorry for asking again I am not very sure, how can I get authenticated using the access token I got with previous steps? – Jose Ramon Feb 14 '16 at 18:58