Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Make a REST GET request to the server at the URL. In this case you are using "http://THESERVER:5000/freakingAwesomeness"
- That GET request will return a JSON object that we will call "response".
- You must be using a library that handles most of the JSON processing for you so that you can simply address the parts of the JSON like a normal dictionary,
- i.e. myDictionary["someKey"] should return the value corresponding to "someKey".
- You only care about response["_items"]. This is a list which you can iterate over. Each item in the list will be a person entry.
- You can then further address the properties of each person object using the same syntax, i.e. person["firstname"].
- Iteration example:
- // PSEUDO CODE WARNING
- //This is an example of getting all the people objects from a database called "freakingAwesomeness" on a server located at "THESERVER:5000".
- response = RESTLibrary.get("http://THESERVER:5000/freakingAwesomeness")
- for (int i = 0; i < length(response["_items"])){
- print(response["_items"][i]["firstname"])
- }
Advertisement
Add Comment
Please, Sign In to add comment