Skip to content

Commit f6f6119

Browse files
authored
Merge pull request #37 from emilesilvis/chore/examples
chore: updated examples to use http://dummy.restapiexample.com
2 parents 25ba69e + 1339621 commit f6f6119

File tree

5 files changed

+24
-31
lines changed

5 files changed

+24
-31
lines changed

examples/delete/delete.pde

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import http.requests.*;
22

3-
public void setup()
3+
public void setup()
44
{
5-
size(400,400);
6-
smooth();
7-
8-
DeleteRequest delete = new DeleteRequest("http://httprocessing.heroku.com");
9-
delete.send();
10-
System.out.println("Reponse Content: " + delete.getContent());
11-
System.out.println("Reponse Content-Length Header: " + delete.getHeader("Content-Length"));
5+
size(400, 400);
6+
smooth();
7+
8+
DeleteRequest delete = new DeleteRequest("http://dummy.restapiexample.com/api/v1/delete/971");
9+
delete.addHeader("Content-Type", "application/json");
10+
delete.send();
11+
System.out.println("Reponse Content: " + delete.getContent());
12+
System.out.println("Reponse Content-Length Header: " + delete.getHeader("Content-Length"));
1213
}

examples/get/get.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import http.requests.*;
22

3-
public void setup()
3+
public void setup()
44
{
55
size(400,400);
66
smooth();
7-
8-
GetRequest get = new GetRequest("http://httprocessing.heroku.com");
7+
8+
GetRequest get = new GetRequest("http://dummy.restapiexample.com/api/v1/employees/1");
99
get.send();
1010
println("Reponse Content: " + get.getContent());
1111
println("Reponse Content-Length Header: " + get.getHeader("Content-Length"));

examples/jsonget/jsonget.pde

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
import http.requests.*;
22

3-
public void setup()
3+
public void setup()
44
{
5-
size(400,400);
6-
smooth();
7-
8-
GetRequest get = new GetRequest("http://connect.doodle3d.com/api/list.example");
5+
size(400,400);
6+
smooth();
7+
8+
GetRequest get = new GetRequest("http://dummy.restapiexample.com/api/v1/employees");
99
get.send(); // program will wait untill the request is completed
1010
println("response: " + get.getContent());
1111

1212
JSONObject response = parseJSONObject(get.getContent());
1313
println("status: " + response.getString("status"));
14-
JSONArray boxes = response.getJSONArray("data");
15-
println("boxes: ");
16-
for(int i=0;i<boxes.size();i++) {
17-
JSONObject box = boxes.getJSONObject(i);
18-
println(" wifiboxid: " + box.getString("wifiboxid"));
19-
}
14+
println("data: " + response.getJSONArray("data"));
2015
}

examples/jsonpost/jsonpost.pde

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import http.requests.*;
22

3-
public void setup()
4-
{
3+
public void setup() {
54
size(400, 400);
6-
smooth();
7-
8-
PostRequest post = new PostRequest("http://httprocessing.heroku.com");
5+
PostRequest post = new PostRequest("http://dummy.restapiexample.com/api/v1/create");
96
post.addHeader("Content-Type", "application/json");
10-
post.addData("{\"on\":false}");
7+
post.addData("{\"name\":\"Daniel Shiffman\",\"salary\":\"123\",\"age\":\"23\"}");
118
post.send();
129
System.out.println("Reponse Content: " + post.getContent());
1310
System.out.println("Reponse Content-Length Header: " + post.getHeader("Content-Length"));

examples/jsonput/jsonput.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import http.requests.*;
22

3-
public void setup()
3+
public void setup()
44
{
55
size(400, 400);
66
smooth();
77

8-
PutRequest put = new PutRequest("http://httprocessing.heroku.com");
8+
PutRequest put = new PutRequest("http://dummy.restapiexample.com/api/v1/update/43");
99
put.addHeader("Content-Type", "application/json");
10-
put.addData("{\"on\":false}");
10+
put.addData("{\"name\":\"Daniel Shiffman\",\"salary\":\"1123\",\"age\":\"23\"}");
1111
put.send();
1212
System.out.println("Reponse Content: " + put.getContent());
1313
System.out.println("Reponse Content-Length Header: " + put.getHeader("Content-Length"));

0 commit comments

Comments
 (0)