-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from emilesilvis/chore/examples
chore: updated examples to use http://dummy.restapiexample.com
- Loading branch information
Showing
5 changed files
with
24 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import http.requests.*; | ||
|
||
public void setup() | ||
public void setup() | ||
{ | ||
size(400,400); | ||
smooth(); | ||
|
||
DeleteRequest delete = new DeleteRequest("http://httprocessing.heroku.com"); | ||
delete.send(); | ||
System.out.println("Reponse Content: " + delete.getContent()); | ||
System.out.println("Reponse Content-Length Header: " + delete.getHeader("Content-Length")); | ||
size(400, 400); | ||
smooth(); | ||
|
||
DeleteRequest delete = new DeleteRequest("http://dummy.restapiexample.com/api/v1/delete/971"); | ||
delete.addHeader("Content-Type", "application/json"); | ||
delete.send(); | ||
System.out.println("Reponse Content: " + delete.getContent()); | ||
System.out.println("Reponse Content-Length Header: " + delete.getHeader("Content-Length")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
import http.requests.*; | ||
|
||
public void setup() | ||
public void setup() | ||
{ | ||
size(400,400); | ||
smooth(); | ||
GetRequest get = new GetRequest("http://connect.doodle3d.com/api/list.example"); | ||
size(400,400); | ||
smooth(); | ||
|
||
GetRequest get = new GetRequest("http://dummy.restapiexample.com/api/v1/employees"); | ||
get.send(); // program will wait untill the request is completed | ||
println("response: " + get.getContent()); | ||
|
||
JSONObject response = parseJSONObject(get.getContent()); | ||
println("status: " + response.getString("status")); | ||
JSONArray boxes = response.getJSONArray("data"); | ||
println("boxes: "); | ||
for(int i=0;i<boxes.size();i++) { | ||
JSONObject box = boxes.getJSONObject(i); | ||
println(" wifiboxid: " + box.getString("wifiboxid")); | ||
} | ||
println("data: " + response.getJSONArray("data")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters