+ Reply to Thread
Results 1 to 5 of 5

HTTP Requests with VBA

  1. #1
    Registered User
    Join Date
    08-12-2019
    Location
    NYC
    MS-Off Ver
    2019
    Posts
    88

    HTTP Requests with VBA

    Hi there,

    Im trying to assess if it is possible to make a spreadsheet communicate with my website / server using HTTP requests. More specifically, I want my spreadsheet to communicate with certain plugins installed on my website. As per their respective documentations, the plugins seem to be built to communicate via API with GET and POST methods (i.e. sorry for my very approximate understanding):
    https://woosoftwarelicense.com/docum...n/api-methods/
    https://woosoftwarelicense.com/docum...nted_statuses/
    https://pluginever.com/docs/wocommer...bers-api-docs/
    https://www.storeapps.org/docs/wcsk-...nst-a-product/

    Not being familiar with API at all, I first would like to assess if these plugins would be able to communicate with a spreadsheet via the appropriate VBA code? If so, would that require additional libraries / external add-ins for the spreadsheet? I would like for the spreadsheet to work without the need of any external file (so any user can use it right from the start).

    Obviously, I dont intend to build the VBA code myself (way beyond my level) and would get the help of a developer but before making the request, I want to confirm that's even feasible (and how difficult you think it is).

    Thanks a lot,

  2. #2
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    17,739

    Re: HTTP Requests with VBA

    Because you are only asking if it's possible, yes, it's possible for VBA to send HTTP API calls.

    I'm not following the reference to plug-ins. Plug-ins are pieces of software installed to the browser allowing certain client-side functionality. An API is a call to server-side functionality. EDIT: It looks like you are talking about server-side plug-ins that you install to your own web site that you are the administrator for. In that case, VBA doesn't care that it's a plug-in; it just sends a URL with the parameters and whatever is on the other side is a black box.

    You don't need any special libraries. You just need to be able to understand the API documentation, write the corresponding VBA code, and parse the response.

    My rough guess at effort for someone who already knows how to do this would be maybe 2 hours to develop and test four different APIs plus the time it would take to drive the APIs from your specific worksheet data. There is no way to estimate the latter without a lot more detail.
    Last edited by 6StringJazzer; 04-18-2021 at 01:14 PM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-12-2019
    Location
    NYC
    MS-Off Ver
    2019
    Posts
    88

    Re: HTTP Requests with VBA

    Thanks! Sorry for the confusion. Yes, the plugin I'm referring to is just something installed on the server side that executes certain tasks (here it creates license keys). I just wanted to confirm that it's possible with Excel / VBA (with no additional library or anything else) to communicate with this plugin via HTTP API requests (which seems to be the way this plugin is supposed to communicate with whatever product it is used for). So based on your message, I understand that it should be possible in theory (agreeing that I didn't provide much details)

    Thanks again

  4. #4
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    17,739

    Re: HTTP Requests with VBA

    VBA has the ability to send HTTP requests to a web server. I think you may need to add a library reference, but it's built-in, you don't have to install anything. Then you build the URL; for a GET everything is right in the URL. I suppose you could just as easily build a header for a POST request as well but I have not done that. Then you send it and IIRC it is a synchronous response, so the next line of code retrieves the response. Then you do with the response whatever it is you need to do.

    The parts that you would need to provide detail as to:

    • What event triggers the API call. A button? Changes on the worksheet? Timers?
    • What data is used to build the API call, assuming this is the worksheet
    • What you want to do with the result that comes back. The doc you linked is a little fuzzy on the format of the response.

    We have a Commercial Service forum where you can offer points (1 point costs you $1 and gets the developer $0.75; the forum takes 25% as a commission) to solve problems like this that are too weighty to just ask someone to do for free.

  5. #5
    Registered User
    Join Date
    08-12-2019
    Location
    NYC
    MS-Off Ver
    2019
    Posts
    88

    Re: HTTP Requests with VBA

    Thanks again 6StringJazzer. The general idea is for the spreadsheet to send a request to the plugin at opening (or if the user cliks on a button to manage his license key) to check that the license entered by the user is valid. The spreadsheet will also collect the user's PC ID to confirm that it's the right one associated with that license key (stored in the custom field of the plugin) or associate that ID with the key if no ID is currently associated with that key (first opening). Depending on the result, the spreadsheet will either end the check (valid key) or close the spreadsheet (invalid key or already used key with another computer).

    Looking at the documentation of the plugin, I see that they provide some API integration code example on this page:
    https://woosoftwarelicense.com/docum...-code-example/

    This code seems to be in PHP though, so that's why I'm wondering if it's possible to achieve the same thing with VBA.

    Interested in using the forum's commercial service once I confirm it's at all feasible to combine this plugin + vba. Not sure however how much work (and points) such ask would require to be honest.

    Thanks

+ 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. [SOLVED] Screen Freezes When Calling HTTP Requests
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 04-25-2018, 05:38 AM
  2. [SOLVED] Multiple Worksheet_Change requests - Unable to get requests working simultaneously
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-17-2017, 12:39 PM
  3. Replies: 2
    Last Post: 07-12-2017, 02:41 AM
  4. [SOLVED] Matching strings within long http GET requests and displaying matches
    By sd24801 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-17-2014, 02:42 PM
  5. Replies: 8
    Last Post: 01-30-2014, 03:12 PM
  6. Exploring HTTP requests, GET, POST, PUT
    By excelenergy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2012, 07:39 PM
  7. Exceeding Cell Limit with HTTP requests
    By josephrowan in forum Excel General
    Replies: 0
    Last Post: 04-20-2006, 09:30 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