Get a value from Json object

GoJakie

Board Regular
Joined
Dec 1, 2007
Messages
176
I dont know if this is possible in excel and need your advice. If I enter the below url in the browser,I get a Json object with a "is_verified" parameter either true or false.
https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username="nokia"
This is what i get
Code:
{
   "data": [
      {
         "is_verified": true
      }
   ]
}
The above link has a nokia pagename, In excel, in the range A1:A782, I have list of facebook pagename, Is it possible to get the status via Json object in excel vba?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Yes, just send a request in the normal way and use instr to test if "true" is in the response
 
Upvote 0
trying a lot but no success
Code:
Function Verify(sPagename As String) As String

  Static oHTTP As WinHttpRequest
  sURL="https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=" & sPagename

  If oHTTP Is Nothing Then Set oHTTP = New WinHttpRequest

  On Error GoTo Oops
  With oHTTP
    .Open "GET", sURL
    .Send

what do i do here ??????

    Exit Function
  End With

Oops:
  Verify = False
End Function
 
Upvote 0
Code:
Function Verify(sPagename As String) As Boolean


  Static oHTTP As WinHttpRequest
  sURL="https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=" & sPagename


  If oHTTP Is Nothing Then Set oHTTP = New WinHttpRequest


  On Error GoTo Oops
  With oHTTP
    .Open "GET", sURL, FALSE
    .Send
    if instr(.responseText, "true") > 0 then Verify = True
what do i do here ??????


    Exit Function
  End With


Oops:
  Verify = False
End Function
 
Upvote 0
It was still not giving the correct result after checking it once again, I found a silly mistake in defining the sURL
The correct way was sURL = "https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=" & "'" & sPagename & "'"

Issue resolved. Thanks for your help
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top