+ Reply to Thread
Results 1 to 2 of 2

Programming an HTTP Post (with body) into VBA and returning the data in a cell

  1. #1
    Registered User
    Join Date
    04-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    1

    Programming an HTTP Post (with body) into VBA and returning the data in a cell

    I am currently working with Postman and have managed to successfully use the POST function to return the correct data.

    I would like to program this same function as a VBA macro but have had real trouble with the examples I have found on the web mainly because the POST involves a body of search and not just parameters.

    My API address is : api.wego.com/flights/api/k/2/searches?api_key=2fb2e750a9da3c674bc3&ts_code=9881b
    You have all the keys...

    The body of my API search is this:
    {
    "trips": [
    {
    "departure_code":"LHR",
    "arrival_code": "FRA",
    "outbound_date": "2014-05-10",
    "inbound_date": "2014-05-13"
    }
    ],

    "adults_count":1,
    "user_country_code":"GB",
    "country_site_code":"GB"
    }


    and the API returns:

    {
    id: "nteYgzufT8Od8u0_kxJzAA"
    key: "[LHR:FRA:2014-05-10:2014-05-13]~1~0~GB~GB"
    -trips: [
    -{
    id: "LHR:FRA:2014-05-10:2014-05-13"
    departure_code: "LHR"
    departure_name: "London Heathrow Apt"
    departure_country_code: "GB"
    departure_country_name: "United Kingdom"
    arrival_code: "FRA"
    arrival_name: "Frankfurt"
    arrival_country_code: "DE"
    arrival_country_name: "Germany"
    outbound_date: "2014-05-10"
    inbound_date: "2014-05-13"
    trip_type: "standard"
    }
    ]
    cabin: "economy"
    adults_count: 1
    country_site_code: "GB"
    user_country_code: "GB"
    created_at: "2014-04-08T18:36:46.485+08:00"
    }

    postman.png

    I have attached the screenshot from my Postman

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,218

    Re: Programming an HTTP Post (with body) into VBA and returning the data in a cell

    Look at the raw tab in postman to get the actual body to send

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 01-30-2014, 03:12 PM
  2. Upload current document to http server (using POST)
    By Henkjan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-17-2013, 12:37 PM
  3. Exploring HTTP requests, GET, POST, PUT
    By excelenergy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2012, 07:39 PM
  4. HTTP Post
    By hellowit in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2012, 11:22 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1