JavaScript is required to use Bungie.net

Forums

originally posted in:BungieNetPlatform
9/14/2015 6:22:50 AM
4
Can somebody help me, I really don't understand this API at all, I am very new to programming, and I am trying to use C# to write a program that uses this API to display information about a user and others. But I honestly don't know how to ask the application to get data, nor do I know how to display that data once it has been retrieved.
English

Posting in language:

 

Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • well, i'll recommend first go to some online courses or read some books about C#, and once you get a good feeling of how to do network calls and how a C# app works, and then, if you still have question in how to use this API, we can help you out with those :) Cause, at the end this is just a REST API, you get a token, you make a request and you get a JSON object back as result. But, if you don't know how to work with that, is hard to tell you what to do next at this moment.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Edited by Holy Breadstick: 9/16/2015 4:06:16 PM
    Okay I have been looking things up and so far I am kind of understanding it. I can have it go to bungie.net/something and retrieve the .json file, and I can sort of use that information. If the information I am looking to pull out is in this form, I can use it. "Response": { "data": { "nightfallActivityHash": 0, But once the data gets into array I cannot seem to understand them. I can use x.Response.data.nightfallActivityHash and then I can retrieve the 0. But if the thing I am looking for is in this form I get lost. "arena": [ { "activityHash": 2074618695, "iconPath": "/img/destiny_content/arena/32_challenge.v2.png", once something goes into the [ I cannot make a x.Response.data.arena.activityHash to get the information out of that. Please help me, once I figure out how to read that kind of data my project will really get working.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Oh my friend, I highly recommend that you grab the Newtonsoft.Json library. It is an exceptionally useful C# library for dealing with JSON data. It will take a little getting used to, but once you do you won't have to worry about any of the details of parsing that JSON: it'll come down to you as properties as an object, and you can even create your own contract classes and use Newtonsoft.Json to deserialize the JSON right to those objects. Definitely start playing with Newtonsoft.Json, get a feel for how it works and how it lets you access properties (including arrays of complex objects). You will be very glad you did! Also, look into how you can bind JSON data to model classes with Newtonsoft.Json, and then you can make your own classes that have properties for the data you were seeking from the objects. It will make your life so much better.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • I don't know about C# but in Java we have gson library which helps with the conversion of the data for you. You only have to create the model class (pojo) and the mapping is done for you.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

You are not allowed to view this content.
;
preload icon
preload icon
preload icon