-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathExample.java
More file actions
executable file
·34 lines (29 loc) · 945 Bytes
/
Example.java
File metadata and controls
executable file
·34 lines (29 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import com.tripit.api.*;
import com.tripit.auth.*;
import java.io.*;
import java.util.*;
public class Example {
public static void main(String[] args) throws Exception {
Credential cred;
Client client;
cred = new OAuthCredential("CONSUMER_TOKEN",
"CONSUMER_SECRET",
"OAUTH_TOKEN",
"OAUTH_TOKEN_SECRET");
client = new Client(cred, Client.DEFAULT_API_URI_PREFIX);
// list
Map<String, String> listMap = new HashMap<String, String>();
listMap.put("traveler", "false");
listMap.put("format", "json");
Response r;
Type t = null;
t = Type.TRIP;
r = client.list(t, listMap);
System.out.println(r);
// create
Map<String, String> createMap = new HashMap<String, String>();
createMap.put("xml", "<Request><Trip><start_date>2009-12-09</start_date><end_date>2009-12-27</end_date><primary_location>New York, NY</primary_location></Trip></Request>");
r = client.create(createMap);
System.out.println(r);
}
}