### TripIt API 'get' Request URL Structure Source: https://tripit.github.io/api/doc/v1/index This example demonstrates the URL structure for making a 'get' request to retrieve a specific object from the TripIt API. It includes placeholders for the object type and the object's unique ID. ```url https://api.tripit.com/v1/get//id/ ``` -------------------------------- ### Curl Example for Web Authentication Source: https://tripit.github.io/api/doc/v1/index A practical example using curl to make an API request with Web Authentication. This snippet shows how to include user credentials and query the 'list/trip' endpoint. The output includes the HTTP response, demonstrating a successful retrieval of trip data. ```bash $ curl -k -D /dev/tty --user : https://api.tripit.com/v1/list/trip HTTP/1.1 200 OK Server: nginx/0.6.32 Date: Wed, 03 Dec 2008 21:55:59 GMT Content-Type: text/xml; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache 770827 2008-12-17 2008-12-27 New York, NY, December 2008 /images/places/general.jpg false true New York, NY
New York, NY
New York NY US 40.714269 -74.005973
``` -------------------------------- ### Retrieve a Note Object (XML) Source: https://tripit.github.io/api/doc/v1/index This example shows how to make a GET request to retrieve a specific Note object in XML format. It requires authentication with username and password and specifies the note ID. The response includes detailed information about the note. ```shell $ curl -k -D /dev/tty --user : https://api.tripit.com/v1/get/note/id/586853 HTTP/1.1 200 OK Server: nginx/0.6.32 Date: Wed, 03 Dec 2008 23:05:30 GMT Content-Type: text/xml; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache 586853 Note 2008-12-09 America/Los_Angeles -8:00
444 DeHaro St. San Francisco CA 94107 US 37.764169 -122.402021
Test note. http://www.tripit.com/
$ ``` -------------------------------- ### GET /v1/get/points_program Source: https://tripit.github.io/api/doc/v1/index Lists all configured points programs for a TripIt Pro user account. ```APIDOC ## GET /v1/get/points_program ### Description For a TripIt Pro user account, lists all configured points programs. ### Method GET ### Endpoint https://api.tripit.com/v1/get/points_program ### Parameters #### Query Parameters - **format** (string) - Optional - Specifies the output format (e.g., `json`, `xml`). Defaults to `xml`. ### Request Example ```bash curl -k -D /dev/tty --user : https://api.tripit.com/v1/get/points_program ``` ### Response #### Success Response (200) - **PointsProgram** (object) - Details about a points program. - **id** (string) - Unique identifier for the points program. - **name** (string) - Name of the points program. - **program_url** (string) - URL for the points program. - **program_url_label** (string) - Label for the points program URL. - **description** (string) - Description of the points program. - **points_type** (string) - Type of points (e.g., 'airline', 'hotel'). - **is_traveler** (boolean) - Indicates if the authenticated user is associated with this program. #### Response Example ```xml 1 United MileagePlus https://www.united.com/web/en-US/apps/mileageplus/enroll/default.aspx?lang=en-US Enroll in MileagePlus United Airlines' frequent flyer program. airline true 2 Marriott Bonvoy https://www.marriott.com/loyalty/createAccount.mi Join Marriott Bonvoy Marriott's hotel loyalty program. hotel true ``` ``` -------------------------------- ### Web Authentication Header Example Source: https://tripit.github.io/api/doc/v1/index Demonstrates how to construct the Authorization header for Basic Web Authentication with the TripIt API. This method uses a base64 encoded string of the user's email and password, separated by a colon. It is recommended for testing and development only. ```http Authorization: Basic ZGVubWFya0B0cmlwaXQuY29tOnNlY3JldHBhc3N3b3Jk ``` -------------------------------- ### Retrieve a Note Object (JSON) Source: https://tripit.github.io/api/doc/v1/index This example demonstrates how to retrieve a Note object in JSON format by appending '/format/json' to the request URL. Authentication is required. The JSON response provides structured data for the note. ```shell $ curl -k -D /dev/tty --user : https://api.tripit.com/v1/get/note/id/21765621/format/json HTTP/1.1 200 OK Server: nginx Date: Mon, 27 Sep 2010 18:26:37 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: keep-alive Cache-Control: private { "timestamp":"1285611997", "num_bytes":"880", "NoteObject": { "id":"217623621", "trip_id":"301454907", "is_client_traveler":"false", "relative_url":"/trip_item/show/id/21235681", "display_name":"A fine note", "Image":{ "url":"https://www.tripit.com/uploads/images/0/2/2/00235a44aba776c3abc123def016079631ac285f622.jpg", "caption":"Andy's Picture" }, "DateTime":{ "date":"2009-11-10", "time":"14:00:00", "timezone":"America/Los_Angeles", "utc_offset":"-08:00" }, "Address":{ "address":"444 DeHaro St., San Francisco, CA, 94107", "addr1":"444 DeHaro St.", "city":"San Francisco", "state":"CA", "zip":"94107", "country":"US", "latitude":"37.764246", "longitude":"-122.401694" }, "text":"This is my note", "url":"http://www.tripit.com" } } ``` -------------------------------- ### Create Air Object with XML Source: https://tripit.github.io/api/doc/v1/index This example demonstrates creating an Air object using an XML payload. It includes details like booking information, agency information, flight segments, and traveler details. The API response confirms the creation and provides a unique ID. ```xml true United Airlines 1-800-United-1 example@united.com http://www.united.com/ ABC123 RTW-123 RTW Business Travel Solutions, Inc. (800) 555-7897 jane.doe@rtwtravel.com http://www.rtwtravel.com/ Ms Jane Doe 2009-09-04 2009-09-04 Chicago San Francisco UA 137 23J 2009-09-08 2009-09-08 San Francisco Chicago UA 39 19B John Doe 1234567890 ``` ```bash $ cat /var/tmp/air.xml true United Airlines 1-800-United-1 example@united.com http://www.united.com/ ABC1234567890 RTW-123 RTW Business Travel Solutions, Inc. (800) 555-7897 jane.doe@rtwtravel.com http://www.rtwtravel.com/ Ms Jane Doe 2009-09-04 2009-09-04 Chicago San Francisco UA 137 23J 2009-09-08 2009-09-08 San Francisco Chicago UA 39 19B John Doe 1234567890 $ curl -k -D /dev/tty --data-urlencode xml@/var/tmp/air.xml --user : https://api.tripit.com/v1/create HTTP/1.1 100 Continue HTTP/1.1 200 OK Server: nginx Date: Mon, 31 Aug 2009 23:51:39 GMT Content-Type: text/xml; charset=utf-8 Transfer-Encoding: chunked Connection: close Cache-Control: private 1251762699 2470 1413 426 true /reservation/show/id/1413 Your Flight United Airlines ``` -------------------------------- ### GET /v1/get/trip/id/{trip_id} Source: https://tripit.github.io/api/doc/v1/index Retrieves trip details, optionally including associated objects like flights and weather. ```APIDOC ## GET /v1/get/trip/id/{trip_id} ### Description Retrieves the details of a specific trip. This endpoint can also fetch associated objects such as flight, hotel, or activity reservations by using the `include_objects` parameter. ### Method GET ### Endpoint /v1/get/trip/id/{trip_id} ### Parameters #### Path Parameters - **trip_id** (integer) - Required - The unique identifier of the trip to retrieve. #### Query Parameters - **include_objects** (boolean) - Optional - If set to `true`, the response will include associated reservation objects (e.g., AirObject, HotelObject) and other related data. Defaults to `false`. #### Request Body None ### Request Example ```bash $ curl -D /dev/tty --user : 'https://api.tripit.com/v1/get/trip/id/2785341/include_objects/true' ``` ### Response #### Success Response (200) - **Trip** (object) - Contains the main details of the trip. - **id** (string) - The unique identifier of the trip. - **relative_url** (string) - The relative URL to the trip. - **start_date** (string) - The start date of the trip. - **end_date** (string) - The end date of the trip. - **display_name** (string) - The display name of the trip. - **image_url** (string) - URL for an image representing the trip. - **is_private** (string) - Indicates if the trip is private. - **primary_location** (string) - The primary location of the trip. - **PrimaryLocationAddress** (object) - Address details for the primary location. - **AirObject** (object) - (Included if `include_objects=true`) Details of flight reservations associated with the trip. - **id** (string) - The unique identifier of the air object. - **trip_id** (string) - The ID of the trip associated with this air object. - **is_client_traveler** (string) - Indicates if this is for a client traveler. - **relative_url** (string) - The relative URL to the air object. - **display_name** (string) - The display name of the flight. - **is_purchased** (string) - Indicates if the flight has been purchased. - **Agency** (object) - Information about the travel agency. - **Segment** (object) - Details about a flight segment. - **PartnerAgency** (object) - (Included for qualifying agencies) Information about partner agencies. #### Response Example ```xml 1257208295 4630 false true 2785341 \/trip\/show\/id\/2785341 2009-10-04 2009-11-23 Vienna, Austria, October 2009 http:\/\/www.tripit.com\/images\/places\/general.jpg true Vienna, Austria
Vienna, Austria
Vienna Vienna AT 48.208488 16.372075
4042627 2785341 true \/reservation\/show\/id\/4042627 Your Flight true RTW-123 RTW Business Travel Solutions, Inc. (800) 555-7897 jane.doe@rtwtravel.com.com http:\/\/www.rtwtravel.com\/ Ms Jane Doe 1 2009-11-09 America\/Los_Angeles -08:00 ``` ``` -------------------------------- ### Retrieve a Trip Object with Included Objects (XML) Source: https://tripit.github.io/api/doc/v1/index This example shows how to retrieve a Trip object along with associated objects like AirObject and WeatherObject by setting the 'include_objects' parameter to 'true'. Authentication is required. The response is in XML format and includes nested objects for detailed travel information. ```shell $ curl -D /dev/tty --user : 'https://api.tripit.com/v1/get/trip/id/2785341/include_objects/true' HTTP/1.1 200 OK Server: nginx Date: Tue, 03 Nov 2009 00:31:35 GMT Content-Type: text/xml; charset=utf-8 Transfer-Encoding: chunked Connection: close Cache-Control: private 1257208295 4630 false true 2785341 /trip/show/id/2785341 2009-10-04 2009-11-23 Vienna, Austria, October 2009 http://www.tripit.com/images/places/general.jpg true Vienna, Austria
Vienna, Austria
Vienna Vienna AT 48.208488 16.372075
4042627 2785341 true /reservation/show/id/4042627 Your Flight true RTW-123 RTW Business Travel Solutions, Inc. (800) 555-7897 jane.doe@rtwtravel.com.com http://www.rtwtravel.com/ Ms Jane Doe 1 2009-11-09 America/Los_Angeles -08:00 ``` -------------------------------- ### Create Trip Source: https://tripit.github.io/api/doc/v1/index This endpoint allows you to create a new Trip object. You can provide details such as start and end dates, and primary location. ```APIDOC ## POST /v1/create (Trip) ### Description Creates a new Trip object with specified details. ### Method POST ### Endpoint https://api.tripit.com/v1/create ### Parameters #### Query Parameters - **xml** (string) - Required - The XML payload containing the trip details. - **username** (string) - Required - Your TripIt API username. - **password** (string) - Required - Your TripIt API password. #### Request Body (Provided as XML via `--data-urlencode xml@/var/tmp/trip.xml`) - **Trip.start_date** (string) - The start date of the trip (YYYY-MM-DD). - **Trip.end_date** (string) - The end date of the trip (YYYY-MM-DD). - **Trip.primary_location** (string) - The primary location for the trip. - **Trip.PrimaryLocationAddress** (object) - Details of the primary location's address. - **address** (string) - **city** (string) - **state** (string) - **country** (string) - **latitude** (number) - **longitude** (number) ### Request Example ```xml 2008-12-09 2008-12-27 New York, NY
New York, NY
New York NY US 40.714269 -74.005973
``` ### Response #### Success Response (200) - **Trip.id** (string) - The unique identifier for the created trip. - **Trip.start_date** (string) - The start date of the trip. - **Trip.end_date** (string) - The end date of the trip. - **Trip.display_name** (string) - A display name for the trip. - **Trip.image_url** (string) - URL to an image associated with the trip's location. - **Trip.is_private** (boolean) - Indicates if the trip is private. - **Trip.is_traveler** (boolean) - Indicates if the user is a traveler for this trip. - **Trip.primary_location** (string) - The primary location of the trip. - **Trip.PrimaryLocationAddress** (object) - Address details of the primary location. #### Response Example ```xml 770846 2008-12-09 2008-12-27 New York, NY, December 2008 /images/places/general.jpg false true New York, NY
New York, NY
New York NY US 40.714269 -74.005973
``` ``` -------------------------------- ### Create Trip Object Request (XML) Source: https://tripit.github.io/api/doc/v1/index This XML snippet demonstrates the POST data required to create a private Trip object. It includes essential trip details like start date, end date, privacy status, and primary location. ```xml 2010-09-07 2010-09-18 true Rome, Italy ``` -------------------------------- ### Delete TripIt Object using HTTP GET Source: https://tripit.github.io/api/doc/v1/index Shows the generic URL structure for deleting any TripIt object. This involves making an HTTP GET request to a specific endpoint, with the object type and its unique ID provided in the URL. Supported object types include air, activity, car, and note, among others. ```bash https://api.tripit.com/v1/delete//id/ ``` -------------------------------- ### Create NoteObject using cURL Source: https://tripit.github.io/api/doc/v1/index Demonstrates how to create a NoteObject by sending an XML payload via a cURL command. Requires username, password, and a local XML file. The API responds with a 200 OK status and an XML confirmation. ```bash $ cat /var/tmp/note.xml A Test Note 2010-12-09
500 Treat Avenue San Francisco CA 94110 US
Test note. http://www.tripit.com/
$ curl -D /dev/tty --user : --data-urlencode xml@/var/tmp/note.xml https://api.tripit.com/v1/create ``` -------------------------------- ### Resource URLs and Methods Source: https://tripit.github.io/api/doc/v1/index Details the available HTTP methods for interacting with various TripIt resource objects. ```APIDOC ## Resource URLs and Methods ### Description The TripIt API supports standard RESTful operations for managing various travel-related objects. The following methods are available for most resource types: - **get**: Retrieves a specific resource by its ID. - **list**: Retrieves a collection of resources, often with filtering and pagination options. - **create**: Creates a new resource. - **replace**: Replaces an existing resource entirely. - **delete**: Deletes a specific resource by its ID. ### Examples (Conceptual) #### Get a Trip ``` GET /v1/trip/ ``` #### List all Trips ``` GET /v1/list/trip ``` #### Create a new AirObject ``` POST /v1/AirObject ``` #### Replace an existing LodgingObject ``` PUT /v1/LodgingObject/ ``` #### Delete a ParkingObject ``` DELETE /v1/ParkingObject/ ``` ### Supported Objects * AirObject * ActivityObject * CarObject * ParkingObject * CruiseObject * DirectionsObject * LodgingObject * MapObject * NoteObject * ProfileObject * RailObject * RestaurantObject * TransportObject * TripObject * WeatherObject (read-only) * PartnerAgency (special) * TripParticipantObject (special) ``` -------------------------------- ### GET /v1/get/note/id/{note_id} Source: https://tripit.github.io/api/doc/v1/index Retrieves a specific Note object by its ID in XML format. ```APIDOC ## GET /v1/get/note/id/{note_id} ### Description Retrieves a specific Note object by its ID. This endpoint returns the note details in XML format. ### Method GET ### Endpoint /v1/get/note/id/{note_id} ### Parameters #### Path Parameters - **note_id** (integer) - Required - The unique identifier of the note to retrieve. #### Query Parameters None #### Request Body None ### Request Example ```bash $ curl -k -D /dev/tty --user : https://api.tripit.com/v1/get/note/id/586853 ``` ### Response #### Success Response (200) - **NoteObject** (object) - Contains the details of the note. - **id** (string) - The unique identifier of the note. - **display_name** (string) - The display name of the note. - **DateTime** (object) - Date and time information for the note. - **Address** (object) - Address associated with the note. - **text** (string) - The content of the note. - **url** (string) - A URL related to the note. #### Response Example ```xml 586853 Note 2008-12-09 America/Los_Angeles -8:00
444 DeHaro St. San Francisco CA 94107 US 37.764169 -122.402021
Test note. http://www.tripit.com/
``` ``` -------------------------------- ### GET /v1/get/note/id/{note_id}/format/json Source: https://tripit.github.io/api/doc/v1/index Retrieves a specific Note object by its ID in JSON format. ```APIDOC ## GET /v1/get/note/id/{note_id}/format/json ### Description Retrieves a specific Note object by its ID. This endpoint returns the note details in JSON format. ### Method GET ### Endpoint /v1/get/note/id/{note_id}/format/json ### Parameters #### Path Parameters - **note_id** (integer) - Required - The unique identifier of the note to retrieve. #### Query Parameters None #### Request Body None ### Request Example ```bash $ curl -k -D /dev/tty --user : https://api.tripit.com/v1/get/note/id/21765621/format/json ``` ### Response #### Success Response (200) - **NoteObject** (object) - Contains the details of the note. - **id** (string) - The unique identifier of the note. - **trip_id** (string) - The ID of the trip associated with the note. - **is_client_traveler** (string) - Indicates if the note is for a client traveler. - **relative_url** (string) - The relative URL to the note. - **display_name** (string) - The display name of the note. - **Image** (object) - Image associated with the note. - **DateTime** (object) - Date and time information for the note. - **Address** (object) - Address associated with the note. - **text** (string) - The content of the note. - **url** (string) - A URL related to the note. #### Response Example ```json { "timestamp":"1285611997", "num_bytes":"880", "NoteObject": { "id":"217623621", "trip_id":"301454907", "is_client_traveler":"false", "relative_url":"\/trip_item/show/id/21235681", "display_name":"A fine note", "Image":{ "url":"https:\/\/www.tripit.com\/uploads\/images\/0\/2\/2\/00235a44aba776c3abc123def016079631ac285f622.jpg", "caption":"Andy's Picture" }, "DateTime":{ "date":"2009-11-10", "time":"14:00:00", "timezone":"America\/Los_Angeles", "utc_offset":"-08:00" }, "Address":{ "address":"444 DeHaro St., San Francisco, CA, 94107", "addr1":"444 DeHaro St.", "city":"San Francisco", "state":"CA", "zip":"94107", "country":"US", "latitude":"37.764246", "longitude":"-122.401694" }, "text":"This is my note", "url":"http:\/\/www.tripit.com" } } ``` ``` -------------------------------- ### GET /v1/list/trip Source: https://tripit.github.io/api/doc/v1/index Lists all trips associated with the authenticated user's account. This endpoint is available for all users. ```APIDOC ## GET /v1/list/trip ### Description Lists all trips associated with the authenticated user's account. ### Method GET ### Endpoint https://api.tripit.com/v1/list/trip ### Parameters #### Query Parameters - **format** (string) - Optional - Specifies the output format (e.g., `json`, `xml`). Defaults to `xml`. ### Request Example ```bash curl -k -D /dev/tty --user : https://api.tripit.com/v1/list/trip ``` ### Response #### Success Response (200) - **Trip** (object) - Contains details about a single trip. - **id** (string) - Unique identifier for the trip. - **start_date** (string) - The start date of the trip (YYYY-MM-DD). - **end_date** (string) - The end date of the trip (YYYY-MM-DD). - **display_name** (string) - A user-friendly name for the trip. - **image_url** (string) - URL for an image representing the trip. - **is_private** (boolean) - Indicates if the trip is private. - **is_traveler** (boolean) - Indicates if the authenticated user is a traveler in this trip. - **primary_location** (string) - The primary location of the trip. - **PrimaryLocationAddress** (object) - Address details for the primary location. - **address** (string) - **city** (string) - **state** (string) - **country** (string) - **latitude** (number) - **longitude** (number) #### Response Example ```xml 770827 2008-12-17 2008-12-27 New York, NY, December 2008 /images/places/general.jpg false true New York, NY
New York, NY
New York NY US 40.714269 -74.005973
``` ``` -------------------------------- ### Release Notes Source: https://tripit.github.io/api/doc/v1/index Known issues and considerations for the v1 API. ```APIDOC ## Release Notes ### Known Issues: - Not all travel objects may display images sent via the API due to UI limitations. - The API does not validate input string lengths, potentially leading to silent truncation. ``` -------------------------------- ### Common Query Parameters Source: https://tripit.github.io/api/doc/v1/index Describes common query parameters applicable to most API requests, including data format and compression. ```APIDOC ## Common Query Parameters ### Description These parameters can be used across various API requests to control response format and optimize data transfer. ### Parameters #### Query Parameters - **format** (string) - Optional - Specifies the response format. Accepted values are 'xml' (default) or 'json'. Using 'json' is recommended for reduced response size. - **Accept-Encoding** (Header) - Optional - When set to 'gzip', it enables compression for the response, further reducing data size. - **User-agent** (Header) - Required - Should include the name and version of your application. ```