TheCDC

Untitled

Oct 3rd, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Make a REST GET request to the server at the URL. In this case you are using "http://THESERVER:5000/freakingAwesomeness"
  2.  
  3. That GET request will return a JSON object that we will call "response".
  4.  
  5. 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,
  6. i.e. myDictionary["someKey"] should return the value corresponding to "someKey".
  7.  
  8. 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.
  9.  
  10. You can then further address the properties of each person object using the same syntax, i.e. person["firstname"].
  11.  
  12. Iteration example:
  13. // PSEUDO CODE WARNING
  14. //This is an example of getting all the people objects from a database called "freakingAwesomeness" on a server located at "THESERVER:5000".
  15.  
  16. response = RESTLibrary.get("http://THESERVER:5000/freakingAwesomeness")
  17.  
  18. for (int i = 0; i < length(response["_items"])){
  19. print(response["_items"][i]["firstname"])
  20. }
Advertisement
Add Comment
Please, Sign In to add comment