+ Reply to Thread
Results 1 to 12 of 12

WINHTTP / JSON post body to include search array from excel

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    WINHTTP / JSON post body to include search array from excel

    Hi all,

    first of all - my apologies for this question and perhaps my follow up. I'm just dabbling with this first and do not have a thorough background in javascript/jquery (or is this PHP?).

    However, my question is this: I pull data from a website via a winhttp request in excel. This website gives me a json from parameters I send in the body.

    I found that I can add parameters by defining them - for example, I add #31 by adding as below into the body:

    Please Login or Register  to view this content.
    Now, I want to define which countries to pull. I can pull one by saying:
    Please Login or Register  to view this content.
    (this would include Sweden).

    I can pull multiple by leaving the search empty, but adding:

    Please Login or Register  to view this content.
    which would give me all the country codes between "A" and "C".

    However, what would I have to add if I wanted to look for an array of countries, let's say "SE, FI, NO, DE, UK" ? I have no clue how to add that in (or if it's possible at all).

    Again, apologies for my question and limited knowledge, but I'm hoping that someone is able to help

    Thanks!

    Jasper

    ps - crossposted here

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: WINHTTP / JSON post body to include search array from excel

    JasperD's desperately yet full of hope glancing at Kyle123 from across the board...

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: WINHTTP / JSON post body to include search array from excel

    Haha! I was doing exactly the same when I needed this from him..

    http://www.excelforum.com/excel-prog...ml#post4096597
    Cheers!
    Deep Dave

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: WINHTTP / JSON post body to include search array from excel

    Yes, Kyle is awesome generally. He's virtually saved my life on many occasions.

    I've gone over your thread - doesn't look like you had the same issue, so I guess you just meant you needed something from him, not specifically this

    I've been digging deeper and it seems like my correct question should be:
    "Get DATATABLES JSON with OR search on a column via VBA HTML request body"

    I cannot do anything server side, just client side, but seems like it's not possible to do an OR search....

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: WINHTTP / JSON post body to include search array from excel

    Yes, our issues are totally different, except for the common fact that Kyle is our Saviour..

    Good luck with your search.. Hope you get your answer soon..

    Cheers!

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

    Re: WINHTTP / JSON post body to include search array from excel

    Hi, I believe that if you pass an empty string it will return unfiltered results. Searching for multiples like that in datatables isn't supported, so I'd be surprised if it's possible, though it's not being the reasons of possibility that whoever's created the service has implemented this. Is there any way to do that on the page? If not I suspect you're out of luck.

    If you want to read up on the params you can pass, the site is using server side processing, explicitly using the legacy version of datatables

  7. #7
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: WINHTTP / JSON post body to include search array from excel

    Hi Kyle,

    many thanks for your reply - sadly this was not what I was hoping for, but I did fear it was that way.
    There's no way to do it on the site, so I guess I'm out of luck. My approach now will be to send several XML requests with just one filter (IF I can get them to work with cookies) at once and just wait until they're all done instead of one by one. Hopefully that will work.

    I'm looking at http://www.datatables.net at server side processing part, but don't find a list of parameters there.
    Am I (my usual) blind or should I look somewhere else? Also, would there be a way to find the code on our site and pick all the possible parameters from there?

    Thanks,

    Jasper

  8. #8
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: WINHTTP / JSON post body to include search array from excel

    XMLHTTP doesn't seem to carry forward the cookie / authentication information as needed (+ it won't work with SetAutoLogonPolicy AutoLogonPolicy_Always) - so is there a way to not wait for a WinHTTP request to be completed in VBA?

    Seems there is no difference between
    .Open "GET", url, False
    and
    .Open "GET", url

    In XMLHTTP the latter would continue the VBA and I could test for it being ready by checking all readystates...
    Can I do the same somehow with WinHTTP?

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

    Re: WINHTTP / JSON post body to include search array from excel


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

    Re: WINHTTP / JSON post body to include search array from excel


  11. #11
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: WINHTTP / JSON post body to include search array from excel

    Hi Kyle,

    awesome!
    Regarding the parameters - I don't see the ones I found I can use as well (sRangeStart, sRangeType and sRangeEnd) so there might be custom ones if I'm not mistaken. But how would I find out what are all parameters available from our site?
    Thanks,

    Jasper

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

    Re: WINHTTP / JSON post body to include search array from excel

    You can't really, ask the person who made it?

+ 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. Body of email to include names of attached files
    By sparx in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2015, 04:34 PM
  2. [SOLVED] xml or winhttp - Can I send a POST request with a lot of parameters?
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 04-02-2015, 04:52 AM
  3. [SOLVED] produce JSON code and POST to website
    By jefjef in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-10-2014, 01:33 PM
  4. how to add mutiple cells to be include in the body of message.
    By DON_BLACK in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2013, 04:59 PM
  5. VBA outlook - Include sheet4 in body of the email
    By xatomicx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2010, 01:06 PM

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