Utilizing RapidAPI in VBA Excel: Discovering Domain Name Ownership

I've come across some other discussions on the same topic, but I haven't been able to find a clear answer. I would really appreciate it if someone could assist me with this problem.

I'm trying to integrate RapidAPI into my VBA code in Excel to retrieve WhoIs information for domain names listed in column A and populate the API response in column B. However, I can't seem to get it to work correctly. Can anyone provide some guidance?

Source:

Function GetWhoIs(DomainName As String)
    Dim json, Url, params As String
    Dim jsonObject, objHTTP, strResult, objetoJson As Object
    Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
    Url = "https://jsonwhois.p.rapidapi.com/api/v1/whois/"
    objHTTP.Open "GET", Url, False
    objHTTP.setRequestHeader "authorization", "Token token=xxxxxxxxxxxxxxxxxx"
    objHTTP.setRequestHeader "x-rapidapi-host", "jsonwhois.p.rapidapi.com"
    objHTTP.setRequestHeader "x-rapidapi-key", "xxxxxxxxxxxxxxxxxxxxxxxx"
    params = "domain=" + DomainName
    objHTTP.Send (params)
    strResult = objHTTP.responseText
    json = strResult
    Set objetoJson = JsonConverter.ParseJson(json)
    GetWhoIs objetoJson
End Function

Sub combine()
    Dim a As String
    For Each a In Range("A2:A50")
        If Not IsEmpty(a.Value) Then
            Range("B" & Rows.Count).End(xlUp).Offset(1, 0) = GetWhoIs(a.Value)
    Next a
End Sub

Answer №1

It appears that you are using a GET method, but at the same time sending data in the request body. This practice is more commonly associated with a POST operation. In the case of a GET request, the data should ideally be included in the URL querystring.

Url = "https://jsonwhois.p.rapidapi.com/api/v1/social?domain=" & DomainName 

Additionally, please remember to remove the (params) from the .Send line –

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

404 Error: JSON POST and GET Request Not Located

I need assistance with setting up an API in Django as I am encountering errors in the JavaScript console. The error messages are: GET http://127.0.0.1:8000/edit/undefined 404 (Not Found) POST http://127.0.0.1:8000/edit/undefined 404 (Not Found) Is there a ...

Unable to assign to array in VBA

There seems to be an issue in my code that I can't figure out. Specifically, the line "Key = decode.GetKeys(issue)" is causing the error mentioned in the title of this question. Public Sub Import_JSON_From_URL(url As JiraJSONGet) ThisWorkbook.Sheets ...

Unable to pass an Array to the Controller

let formData = new FormData(); payloadData = JSON.stringify(payload.unitDoctors); for (var prop in payloadData) { formData.append(prop, payloadData[prop]); } axios({ method: "put", url: apiUrl + payload.id, data: formData }) .then(resp ...

Angular directive dilemma

Angular is causing some issues for me as I am a beginner in using it. Below is the JSON data that I am dealing with: [ { "name":"43", "values":{ "audio":"Audio Only", "low":"Low Bandwidth", "medium":"Medium Bandw ...

Enhancing efficiency in a node.js application through utilization of data stored in a json file

I have a unique requirement in my application to showcase the states of different chemical elements based on specific values. The essential data is stored in a JSON file containing all the necessary information about each element. { "1":{ &qu ...

Removing characters extracted from a Json with an EditText

Can I extract only the date part from a string obtained from a JSONObject response in an EditText field? For example, if the string is '2019-02-10T00: 00: 00', can I display only '2019-02-10'? ...

How can PHP Curl be used to retrieve a corresponding value from a JSON data?

On my webpage, I have some jSON data that I need to gather into arrays using cURL in PHP code, not through the command line. The code snippet below shows how I currently achieve this: $token = 'my_token_here'; $headers = ['Authorization: B ...

Retrieve a nested JSON item using Java code

I'm working with a JSON object that has the following structure: { "accessToken" : "<dont need this>", "clientToken" : "<nor this>", "selectedProfile" : { "id" : "<nope>", "name" : "<I need this>", ...

Using jQuery to send JSON data through AJAX to PHP

I'm attempting to utilize jQuery AJAX to send JSON data to a PHP file. My goal is to extract the values and IDs from multiple child elements, create a JSON object with this data, and then transmit that object to a PHP file for processing and insertion ...

Utilizing jQuery's POST Method to Fetch JSON Data on a Website

I've developed a Java REST API and now I want to retrieve JSON data on my website (which is built using HTML & CSS) by utilizing jQuery. The method to be used is POST, and here is the structure of my JSON: { "sessionID" : "25574", "interactiv ...

Sending Java Servlet JSON Array to HTML

I am currently engaged in a project that requires extracting data from a MySQL database and implementing pagination. My approach involves utilizing JSON AJAX and JavaScript, although I am fairly new to JSON and AJAX. After successfully retrieving the neces ...

Querying objects using a PHP API

Currently facing an issue with the API documentation I'm working on. Despite testing the code, it simply isn't functioning as expected. After spending a considerable amount of time analyzing it, I seem to be at a loss in figuring out where the er ...

Display information in an HTML table using JQuery AJAX and JSON data

As a new member and beginner learner, I have encountered some issues while trying to execute a certain task. Despite looking at similar questions, I couldn't find a solution that worked for me. What I am attempting to do is query my database to retrie ...

Is there a way for me to interpret and process this JSON data?

AngularJS is receiving JSON data from an ArrayList through a get request. The data includes information such as ID, area, gender, and highest education level. 0: Object id:1 area: "State" gender: "Both" highestEd: 36086 ...

Extract keys enclosed in quotation marks using regular expressions

My coding challenge involves working with JSON data in a specific format: define({ somekey : "Some {text} here:", 'some-key' : "Text:", 'key/key' : 'Some : text', key: 'some value', 'my-key' : &a ...

Utilizing JSON for live population of search filter results

I'm currently developing a search function for my website that will sift through a JSON Object using regular expressions. My goal is to have the results displayed in real time as the user types, similar to how Google shows search suggestions. However ...

Utilizing the json_encode() function in PHP and JSON.parse() method in JavaScript for handling file data interchange

Utilizing json_encode() in PHP to store an array in a file, then leveraging JSON.parse() in JavaScript on the client side to read the json encoded file and pass it as an array to a sorting algorithm: The result of my json_encode() operation in the ...

Implementing JSON and JQuery to dynamically update ActionLinks in an MVC table

Here's the HTML code I'm using to display image actions inside a table element: <%= Html.ActionLink("[EditImg]", "Edit", new { id = item.GrossBaseReconId }, new { id = "BaseReconEdit", rowsid = item.GrossBaseReconId }).Replace("[EditImg]", "& ...

Seeking information from JSON data using an internet address

Currently, I am utilizing the following URL to access my JSON data: myapp/laravelRoute/jsondata By entering this in the address bar, the JSON array below will be shown: [{"A":"B"},{"B":1},{"C","http"}] However, when I input the URL as follows: myapp/l ...

Combining JSON data within a MySQL column efficiently with the power of SQLAlchemy

Is there a way to consolidate JSON data that is spread out over multiple rows in a MySQL column using the Python SQLAlchemy library? I tried using json_merge_preserve but encountered difficulties applying it to an entire column. This was the code snippet ...