HotelsUSA API

What follows is the list of API prepared for HotelsUSA front-end applications.

Hotel List

Purpose: This API is to list all hotels.

API Doc: http://www.hotelsusa.com/api/hotels/

Command:

        curl  http://www.hotelsusa.com/api/hotels/
    Output:
        [{"id":1,"name":"Renaissance Woodbridge", ...}, .... ]

Hotel Search

Purpose: This API is to search hotels by criteria.

API Doc: http://www.hotelsusa.com/api/hotels/search/{city_id}

Command:


      Search Hotels in New York City (city_id=1 is New York city)
        curl http://www.hotelsusa.com/api/hotels/search/1/

      Output:
          [{"id":1,"name":"Renaissance Woodbridge", ...}, .... ]

      Search Hotels in New York, price between $150 and $250
          curl -H "Content-Type: application/json" -X POST \
               -d @search-data http://www.hotelsusa.com/api/hotels/search/1/

          @search-data= { "price_min": 200, "price_max": 250 }

      Search Hotels in New York, price between $150 and $250, order by price lowest first
          curl -H "Content-Type: application/json" -X POST \
               -d @search-data http://www.hotelsusa.com/api/hotels/search/1/

          @search-data= { "price_min": 200, "price_max": 250, "order_by":"price_lowest_first" }

      Search Hotels in New York, with star rating 3 and 4
          curl -H "Content-Type: application/json" -X POST \
               -d @search-data http://www.hotelsusa.com/api/hotels/search/1/

          @search-data= { "star_rating":[3,4] }
  
      Search Hotels in New York, with region 1
          curl -H "Content-Type: application/json" -X POST \
               -d @search-data http://www.hotelsusa.com/api/hotels/search/1/
  
          @search-data= { "region_ids":[1,2] }

      Output:
           [{"id":1,"name":"Renaissance Woodbridge", ...}, .... ]

Hotel Detail:

Purpose: This API is to retrieve the detail of a hotel.

API Doc: http://www.hotelsusa.com/api/hotels/{hotel_id}/

Command:

        curl  http://www.hotelsusa.com/api/hotels/1/

    Output:
        {"id":1,"name":"Renaissance Woodbridge", ...}

Hotel Room List:

Purpose: This API is to retrieve the rooms of a hotel.

API Doc: http://www.hotelsusa.com/api/hotels/rooms/{hotel_id}/

Command:

        curl  http://www.hotelsusa.com/api/hotels/rooms/1/

    Output:
        [{"id":1,"name":"DoubleBed + Breakfast", ...}, ... ]

Hotel Room Search:

Purpose: This API is to search the available rooms of a hotel.

API Doc: http://www.hotelsusa.com/api/hotels/rooms/search/{hotel_id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
             -d @room-search http://www.hotelsusa.com/api/hotels/rooms/search/1/
    Input:
        @room-search = { "num_of_rooms":1, "num_of_guests":2 }
    Output:
        [{"id":1,"name":"DoubleBed + Breakfast", ...}, ... ]

City List:

Purpose: This API is to list all cities.

API Doc: http://www.hotelsusa.com/api/cities/

Command:

        curl  http://www.hotelsusa.com/api/cities/

    Output:
        [ { "pk":1,"name":"New York",...,"num_hotels": 12}, {"pk":2,"name":"Washington DC",..., "num_hotels":10},...]

City Pseudo Names:

Purpose: This API is to list the psuedo names of cities

API Doc: http://www.hotelsusa.com/api/cities/names/

Command:

        curl  http://www.hotelsusa.com/api/cities/names/

    Output:

        [{"pk":8,"city":3,"pseudo_name":"Boston"},{"pk":23,"city":8,"pseudo_name":"Canada"},{"pk":21,"city":7,"pseudo_name":"Chicago"},...]


User Interests:

Purpose: This API is to record that the user is interested in a city

API Doc: http://www.hotelsusa.com/api/cities/interestby/1/

Command:

        curl -H "Content-Type: application/json" -X POST \
             -d @email-data http://www.hotelsusa.com/api/cities/interestby/1/

        @email-data={"email":"test@me.com"}

    Output:
        {"record_id":8}


Hotel List in a City:

Purpose: This API is to list all hotels in a city.

API Doc: http://www.hotelsusa.com/api/cities/hotels/{city_id}/

Command:

        curl  http://www.hotelsusa.com/api/cities/hotels/1/

    Output:
         [{"id":1,"name":"Renaissance Woodbridge", ...}, .... ]

Deal List:

Purpose: This API is to list the hot deals.

API Doc: http://www.hotelsusa.com/api/deals/

Command:

        curl  http://www.hotelsusa.com/api/deals/

    Output:
        [{"pk":1,"name":"Deal A", "deal_price":"49.50", 
          "original_price":"160.00","deal_hour":15,"photo":null,"sort_order":1,
          "hotel":{"id":3,"name":"Sheraton Newark",...}}, ...]

Register by Phone:

Purpose: This API is to register a new user with a phone number.

API Doc: http://www.hotelsusa.com/api/user/register-by-phone/

Command:

        curl -H "Content-Type: application/json" -X POST -d @register-data \
          http://www.hotelsusa.com/api/user/register-by-phone/

    Input: The input data also includes data to set the user's Chinese name and language preference
        @register-data = {"phone":"408 555-1212","password":"123456", "email":"takahashi9@me.com", "chinese_name":"高建中", "language_preference":"zh"}}

    Output:
        {"username":"4085551212@phone","token":"...","user_id":15, .... }

Register by Email:

Purpose: This API is to register a new user with an email.

API Doc: http://www.hotelsusa.com/api/user/register-by-email/

Command:

        curl -H "Content-Type: application/json" -X POST -d @register-data \
          http://www.hotelsusa.com/api/user/register-by-email/

    Input:
        @register-data = '{"email":"test@me.com","password":"123456","phone":"1-212-555-1212","first_name":"Alex", "last_name":"Cone"}' 

    Output:
        {"username":"test@me.com","token":"...","user_id":3,"email":"test@me.com"}

Login:

Purpose: This API is to login.

API Doc: http://www.hotelsusa.com/api/user/login/

Command:

        curl -H "Content-Type: application/json" -X POST -d @login-data \
          http://www.hotelsusa.com/api/user/login/

    Input: Login by phone
        @login-data = { "user": "1-509-555-1212", "password": "123456" }

    Output:
        {"username":"Daryl Strawberry","first_name":"Daryl","last_name":"Strawberry","account_type":0,"language_preference":"","chinese_name":"","phone":"15095551212","token":"...","address":"","user_id":52,"email":"strawberry@me.com","account_id":0}

    Input: Login by email
        @login-data = { "user": "test@me.com", "password": "123456" }

    Output:
        {"username":"Howard Johnson","first_name":"Howard","last_name":"Johnson","account_type":0,"language_preference":"zh","chinese_name":"Howard Johnson","phone":"408-555-1212","token":"...","address":"","user_id":3,"email":"test@me.com","account_id":0}

Logout:

Purpose: This API is to logout.

API Doc: http://www.hotelsusa.com/api/user/logout/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          http://www.hotelsusa.com/api/user/logout/

    Output:
	      Empty

All Orders: List all orders

Purpose: This API checks the user type. If the user is a hotel manager or a hotel distributor, it lists all the orders that belong to the hotels managed by the hotel manager. If the user is a travel agent or a consumer, it lists all the orders belong to the user.

API Doc: http://www.hotelsusa.com/api/user/orders/all/

Command:

        curl -H "Authorization: Token " \
            http://www.hotelsusa.com/api/user/orders/all/

List all orders made by a travel agent (login: test@me.com)


        curl -H "Authorization: Token b654ebb104911eb98b5275efc22fea769069078d" \
           http://www.hotelsusa.com/api/user/orders/all/

        Output:
            [ {order1}, {order2}, ... ]

List all orders belonged to the hotels managed by a hotel manager (login: pm@hotelsusa.com)


        curl -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
           http://www.hotelsusa.com/api/user/orders/all/

        Output:
            [ {order1}, {order2}, ... ]

Pending Orders: List all pending orders

Purpose: This API checks the user type. If the user is a hotel manager or a hotel distributor, it lists all the orders belonged to the hotels managed by the hotel manager and the orders were authorized by the users but not yet confirmed. If the user is a travel agent or a consumer, it lists all the orders prepared or authorized by the users but not yet confirmed.

API Doc: http://www.hotelsusa.com/api/user/orders/pending/

Command:

        curl -H "Authorization: Token " \
            http://www.hotelsusa.com/api/user/orders/pending/

List all the pending orders made by a travel agent (login: test@me.com)


        curl -H "Authorization: Token b654ebb104911eb98b5275efc22fea769069078d" \
           http://www.hotelsusa.com/api/user/orders/pending/

        Output:
            [ {order1}, {order2}, ... ]

List all the pending orders belonged to the hotels managed by a hotel manager (login: pm@hotelsusa.com)


        curl -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
           http://www.hotelsusa.com/api/user/orders/pending/

        Output:
            [ {order1}, {order2}, ... ]

Upcoming Orders: List all upcoming orders

Purpose: This API checks the user type. If the user is a hotel manager or a hotel distributor, it lists all the confirmed orders with start dates in the future and the orders are belonged to the hotels managed by the hotel manager. If the user is a travel agent or a consumer, it lists all the confirmed orders with start dates in the future.

API Doc: http://www.hotelsusa.com/api/user/orders/upcoming/

Command:

        curl -H "Authorization: Token " \
            http://www.hotelsusa.com/api/user/orders/upcoming/

List all upcoming orders made by a travel agent (login: test@me.com)


        curl -H "Authorization: Token b654ebb104911eb98b5275efc22fea769069078d" \
           http://www.hotelsusa.com/api/user/orders/upcoming/

        Output:
            [ {order1}, {order2}, ... ]

List all upcoming orders beloinged to the hotels managed by a hotel manager (login: pm@hotelsusa.com)


        curl -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
           http://www.hotelsusa.com/api/user/orders/upcoming/

        Output:
            [ { order1}, {order2}, ... ]

Canceled Orders: List all canceled orders

Purpose: This API checks the user type. If the user is a hotel manager or a hotel distributor, it lists all the canceled orders that are belonged to the hotels managed by the hotel manager. If the user is a travel agent or a consumer, it lists all the canceled orders belonged to the user.

API Doc: http://www.hotelsusa.com/api/user/orders/canceled/

Command:

        curl -H "Authorization: Token " \
            http://www.hotelsusa.com/api/user/orders/canceled/

List all canceled orders made by a travel agent (login: test@me.com)


        curl -H "Authorization: Token b654ebb104911eb98b5275efc22fea769069078d" \
           http://www.hotelsusa.com/api/user/orders/canceled/

        Output:
            [ {canceled order1}, {canceled order2}, ... ]

List all canceled orders belonged to the hotels managed by a hotel manager (login: pm@hotelsusa.com)


        curl -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
           http://www.hotelsusa.com/api/user/orders/canceled/

        Output:
            [ {canceled order1}, {canceled order2}, ... ]

Get an order item:

Purpose: This API is to get a particular order of a user.

API Doc: http://www.hotelsusa.com/api/user/orders/{user-id}/item/{order-id}/

Command:

        curl -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
            http://www.hotelsusa.com/api/user/orders/15/item/4/

    Output:
        { order1 }

Create order:

Purpose: This API is to create an order for a user.

API Doc: http://www.hotelsusa.com/api/user/orders/create/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @order-data http://www.hotelsusa.com/api/user/orders/create/15/

    Input:  Need to pass in description and hotel ID, room type ID
        @order-data= {"description":"Grand Hotel", 
                      "hotel":1, "room_type":1,
                      "start_date":"2015-05-15T00:00:00", "end_date":"2015-05-16T00:00:00", 
                      "num_of_rooms":1, "num_of_guests":2,
                      "guest_first_name":"Allen", "guest_last_name" : "Davis", "guest_email":"allen.davis@gmail.com",
                      "instruction": "Please arrange a non-smoking room",
                      "room_price": 80, "total_amount": 160}

    Output:
        { order_id:101, state:0 }

Obtain WePay form:

Purpose: This API is to create a WePay payment form for a user.

API Doc: http://www.hotelsusa.com/api/user/orders/approval/wepay/{user-id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @wepay-data http://www.hotelsusa.com/api/user/orders/approval/wepay/15/

    Input:  Need to pass in description and hotel ID, room type ID
        @wepay-data= {"description":"HotelsUSA: Grand Hotel",
                      "amount": 160.00,
                      "redirect_uri": "http://www.hotelsusa.com/payment_confirm?order_id=1" }

    Output:
        { preapproval_id:0987654321, preapproval_uri:"http://www.wepay.com/...." }

Change order state to approved:

Purpose:When the payment approval is complete, the front end call the backend API to change order state to "PREAPPROVED".

API Doc: http://www.hotelsusa.com/api/user/orders/approval/update/{user-id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @payment-data http://www.hotelsusa.com/api/user/orders/approval/update/15/

    Input:
        @payment-data= {"id":101, "payment_system":1, "checkout_id":"x1-2345",
                        "subtotal":140, "tax_amount":10, "shipping":10, "additional_fee":6.75,
                        "payment_charge":3.25, "total_amount": 170.00}

    Output:
        { order_id:101, state:1 }

Confirm an order and transfer the payment

Purpose:When the hotel rooms are confirmed, withdraw the payment using preapproval_id and change order state to "CONFIRMED".

API Doc: http://www.hotelsusa.com/api/user/orders/confirm/{order-id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @confirm-data http://www.hotelsusa.com/api/user/orders/confirm/15/

    Input:
        @confirm-data= {confirm_number": "### confirm number from hotel ###"}

    Output:
        { order_id:101, checkout_id:1001 }

Cancel an order

Purpose:Cancel an order

API Doc: http://www.hotelsusa.com/api/user/orders/cancel/{order-id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @payment-data http://www.hotelsusa.com/api/user/orders/cancel/15/

Retrieve user profile:

Purpose: This API is to retrieve user profile.

API Doc: http://www.hotelsusa.com/api/user/profile/{user-id}/

Command:

        curl -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          http://www.hotelsusa.com/api/user/profile/15/

    Output:
        {"username":"magic-name","first_name":"Magic","last_name":"Johnson",
         "phone":"4085551212","address":"","email":""}

Update user profile:

Purpose: This API is to update user profile.

API Doc: http://www.hotelsusa.com/api/user/update-profile/{user-id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @profile-data http://www.hotelsusa.com/api/user/update-profile/15/

    Input:
        profile-data: { "first_name":"Howard", "last_name":"Johnson" }

    Output:
        { ... user profile data ... } 

Reset password:

Purpose: This API is to reset password.

API Doc: http://www.hotelsusa.com/api/user/reset-password/{user-id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @passwd-data http://www.hotelsusa.com/api/user/reset-password/15/

    Input:
        passwd-data: { "orig_password":"123456", "new_password":"123456" }

    Output:
        { user_id: 15 }

Hotels managed by user:

Purpose: This API is to retrieve hotels managed by a user.

API Doc: http://www.hotelsusa.com/api/hotels/managedby/{user-id}/

Command:

        curl  -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
            http://www.hotelsusa.com/api/hotels/managedby/15/

    Output:
        [ { hotel 1}, { hotel 2}, .... ]

Search managed hotels by name

        curl  -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
            http://www.hotelsusa.com/api/hotels/managedby/15/?q=Clark

    Output:
        [ { hotel whose name contains 'Clark' } ]

Change Hotel Contact Info:

Purpose: This API is to change the contact info of the hotel managed by the user.

API Doc: http://www.hotelsusa.com/api/hotels/contactinfo/{hotel-id}/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @contactinfo-data http://www.hotelsusa.com/api/hotels/contactinfo/2/

    Input:
         { "contact_name": "Ed Cox", "contact_email": "ed.cox@me.com", "contact_phone":"1-800-555-1212", "contact_fax": "1-800-555-5555" }

    Output:
         { ... hotel summary data ... } 

Hotels Allotment Rules:

Purpose: This API is to retrieve the allotment rules of a hotel.

API Doc: http://www.hotelsusa.com/api/hotels/allotment/rules/hotel/{hotel-id}/

Command:

        curl -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
            http://www.hotelsusa.com/api/hotels/allotment/rules/hotel/2/

    Output:
        [ { allotment rule 1}, { allotment rule 2}, .... ]

Save Allotment Rule and Generate Allotments:

Purpose: This API is to create or update an allotment rule. Once allotment rule is saved, the API re-generate allotments within the date range.

API Doc: http://www.hotelsusa.com/api/hotels/allotment/rules/rulegen/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @allotment-rule-data http://www.hotelsusa.com/api/hotels/allotment/rules/rulegen/

Create a new allotment rule and generate allotments in the specified date range

        Input:
             @allotment-rule-data = 
               { "hotel": 2, "room": 3, "from_date": "2015-07-01T00:00:00", "to_date": "2015-07-15T00:00:00", 
                 "quantity":20, "agent_price": 85.00 }
        Output:
             { new allotment rule } 

        Note: If the input doesn't contain "id" parameter, this is to create a new allotment rule.
              The "from_date" and "to_date" are required and have the pattern "yyyy-mm-ddTHH:MM:SS"

Update an existing allotment rule and generate allotments in the specified date range

        Input:
             @allotment-rule-data = 
               { "id":6,  hotel": 2, "room": 3, "from_date": "2015-07-01T00:00:00", "to_date": "2015-07-15T00:00:00", 
                 "quantity":20, "agent_price": 85.00 }
        Output:
             { updated allotment rule } 

        Note: To update, the input must contain "id" parameter to indicate which allotment rule to change.
              The allotments that fall between "from_date" and "to_date" will be regenerated.

Save Allotment RuleSet and Generate Allotments:

Purpose: This API is to save a set of allotment rules. In the input, the user provides two parameters. The first parameter "ruleset" is a list of allotment rules. The second parameter "deleted" is a list of IDs. When there are new rules in the "ruleset" parameter, this API will add them to the database. When the rules in the "ruleset" parameter are different from the database entries, this API will save the changes to the database. For the new/changed allotment rules, this API will re-generate allotments based on the definition of the rules.
For the deleted allotment rules, only the database entries will be deleted. It won't affect the allotments originally generated from them.

API Doc: http://www.hotelsusa.com/api/hotels/allotment/rules/rulesetgen/

Command:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @allotment-ruleset http://www.hotelsusa.com/api/hotels/allotment/rules/rulesetgen/

Create a new allotment rule and generate allotments in the specified date range

        Input:
             @allotment-ruleset = 
             {  "ruleset": [
  { "hotel": 2, "room": 3, "from_date": "2015-08-01T00:00:00", "to_date": "2015-08-15T00:00:00", "quantity":20, "agent_price": 85.00 },
  { "hotel": 2, "room": 3, "from_date": "2015-08-16T00:00:00", "to_date": "2015-08-31T00:00:00", "quantity":20, "agent_price": 55.00 }, 
  { "hotel": 2, "room": 4, "from_date": "2015-08-01T00:00:00", "to_date": "2015-08-15T00:00:00", "quantity":20, "agent_price": 95.00 }, 
  { "hotel": 2, "room": 4, "from_date": "2015-08-16T00:00:00", "to_date": "2015-08-31T00:00:00", "quantity":20, "agent_price": 75.00 }],
                "deleted": [] }

        Output:
             [ { allotment rule 1 },  { allotment rule 2 }, { allotment rule 3 }, { allotment rule 4 } ]

        Note: The rules don't contain "id" parameters, they are considered as new allotment rules.

Update an existing allotment rule and generate allotments in the specified date range

        Input:
             @allotment-ruleset = 
             {  "ruleset": [
     { "id": 5, "from_date": "2015-08-01T00:00:00", "to_date": "2015-08-15T00:00:00", "quantity":20, "agent_price": 85.00 },
     { "id": 6, "from_date": "2015-08-16T00:00:00", "to_date": "2015-08-31T00:00:00", "quantity":20, "agent_price": 55.00 }, 
     { "id": 7, "from_date": "2015-08-01T00:00:00", "to_date": "2015-08-15T00:00:00", "quantity":20, "agent_price": 95.00 }, 
     { "id": 8, "from_date": "2015-08-16T00:00:00", "to_date": "2015-08-31T00:00:00", "quantity":20, "agent_price": 75.00 }],
                "deleted": [1, 2, 3, 4] }

        Output:
             { updated allotment rules ... } 

        Note: In the above example, the allotment rules [ 5, 6, 7, 8 ] will be updated. 
              The allotments in the date range of the rules [ 5, 6, 7, 8] will be regenerated. 
              The allotment rules with ID [1, 2, 3, 4] will be deleted.

Hotels Allotments by Month:

Purpose: This API is to retrieve the allotments of a hotel for a particular month.

API Doc: http://www.hotelsusa.com/api/hotels/allotments/hotel/{hotel_id}/year/{year}/month/{month}/

Command:

        curl -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
            http://www.hotelsusa.com/api/hotels/allotments/hotel/2/year/2015/month/8/

        Output:
         [ { allotment rule 1}, { allotment rule 2}, .... ]

Retrieve allotments by month for a particular room


        curl -H "Content-Type: application/json" -X POST \
             -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
             -d @room-search http://www.hotelsusa.com/api/hotels/allotments/hotel/2/year/2015/month/8/

        Input:
             @room-search = { "room": 3 }     # Room ID = 3

        Output:
             [ { allotment rule 1}, { allotment rule 2}, .... ]

Update Allotment Entry

Purpose: This API is to retrieve, update, and delete a specific allotments.

API Doc: http://www.hotelsusa.com/api/hotels/allotments//{id}/

Command:

Retrieve an allotment:

      curl -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
            http://www.hotelsusa.com/api/hotels/allotments/8/

    Output:
        { allotment #8}

Update an allotment:


        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @allotment-data1 http://www.hotelsusa.com/api/hotels/allotments/8/

    Input:
         @allotment-data1 = { "quantity": 10, "agent_price": 65.00 }
    Output:
         status OK

Stop Sales:

        curl -H "Content-Type: application/json" -X POST \
          -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
          -d @allotment-data2 http://www.hotelsusa.com/api/hotels/allotments/8/

    Input:
         @allotment-data2 = { "stop_sales": true }
    Output:
         status OK

Bulk Update Allotments

Purpose: This API is to update a list of allotments. For updates, each entry in the input list needs to contain the 'pk' parameter to indicate the primary key (i.e., id) of the entry.

API Doc: http://www.hotelsusa.com/api/hotels/allotments//batchupdate/

Command:

Upldate a list of allotments:

      curl -H "Content-Type: application/json" -X POST  \
           -H "Authorization: Token f25bdb9ba01a4478ec359601553ab308bf3149d7" \
           -d @allotment-batch  http://dev.hotelsusa.com/api/hotels/allotments/batchupdate/

    Input:
        @allotment-batch = 
            [ {"pk":312,"quantity":10,"agent_price":"65.00"},
              {"pk":313,"stop_sales":true},
              {"pk":314,"release": 2} ]

    Output:
         [ { allotment #1 }, { allotment #2 }, { allotment #3 } ]

Hotel events: List all events associated with a hotel

Purpose: This API lists all the events associated with a hotel. The API is limited to hotel managers and hotel distributors.

API Doc: http://www.hotelsusa.com/api/events/hotel/{hotel_id}

Command:

List all events associated for a hotel


        curl -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
             http://www.hotelsusa.com/api/events/hotel/2/

        Output:
            [ {message:"...", "log_date":"2015-07-01", "sale_date":"2015-10-10"}, ... ]

List all events of a hotel with sales date in the date range


        curl -H "Content-Type: application/json" -X POST \
             -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
             -d @event-search  http://www.hotelsusa.com/api/events/hotel/2/

        Input:
             @event-search = { "sales_start_date":"2015-07-01T00:00:00", "sales_end_date":"2015-07-15T00:00:00" }

        Output:
            [ {message:"...", "log_date":"2015-07-01", "sale_date":"2015-10-10"}, ... ]

List all events of a particular room in a hotel


        curl -H "Content-Type: application/json" -X POST \
             -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
             -d @event-search  http://www.hotelsusa.com/api/events/hotel/2/

        Input:
             @event-search = { "room": 3 }     # Room ID = 3

        Output:
            [ {message:"...", "log_date":"2015-07-01", "sale_date":"2015-10-10"}, ... ]

List all events of a hotel with pagination parameters


        curl -H "Content-Type: application/json" -X POST \
             -H "Authorization: Token d2099444c27913dc7338d6fc8cb2ffb7fc13fc39" \
             -d @event-search  http://www.hotelsusa.com/api/events/hotel/2/

        Input:
             @event-search = { "offset": 20, "limit": 20 }

        Output:
            [ {message:"...", "log_date":"2015-07-01", "sale_date":"2015-10-10"}, ... ]