Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

please strongm, big help

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
411
0
16
IT
Based the link, how to set the GET code for:


Great tks

my test code:
Option Explicit
Private Sub RestExample()

Dim APICall As String
Dim Query As String
Dim strKey As String
Dim myXML As New MSXML2.DOMDocument60
Dim nodes As IXMLDOMSelection

APICall = " With CreateObject("MSXML2.XMLHTTP")
.Open "GET", APICall, False
.setRequestHeader "Authorization", "Bearer zzzzzzzzzzzzzzzzzzzzzzzzzz"
.send
Debug.Print .responseText
End With

End Sub

in debug.print i have:

{"success":false,"message":"No auth provided, Basic Needed","error":110,"data":null}
 
.setRequestHeader "Authorization", "Basic <your_authorisation_code_goes here>"
 
Bro, same error:

Option Explicit
Private Sub RestExample()

Dim APICall As String
Dim Query As String
Dim strKey As String
Dim myXML As New MSXML2.DOMDocument60
Dim nodes As IXMLDOMSelection

APICall = " With CreateObject("MSXML2.XMLHTTP")
.Open "GET", APICall, False
.setRequestHeader "Authorization", "Basic xxxxxxxxxxxxxxxxxxxxxxxxxx"
.send
Debug.Print .responseText
End With

End Sub

i can send you my autorization code?
 
That simply suggests that you have not got the correct token. And that's not a VB6 issue.
 
tks bro.
but in the note of site i see the Authorization, is bas64 encoding

Then:

myvaruser=myvarpass & ":" & mykeyva

i need to encode base64 the string myvaruser, similar

.setRequestHeader "Authorization", "Basic " & Base64Encode(myvaruser)

is this correct?
 
Again, not a VB issue - but what I can say is that when I generated a free basic authentication code on their website, and then used it with my VB above it worked without error and without any additional Base64 encoding ( didn't return any data, of course, since I haven't clocked up any counters, but came back with a successful , empty dataset).

You might want to check whether you are trying touse a token rather than an APIkey - they are different things, and OAUTH requires an APIKey.

Should be visible on [URL unfurl="true"]https://developers.openapi.it/config[/url]
 
resolved with basic64.

Code:
 Private Sub RestExample()

    Dim APICall As String
    Dim Query As String
    Dim strKey As String, STRINGA As String
    Dim myXML As New MSXML2.DOMDocument60
    Dim nodes As IXMLDOMSelection

    APICall = "[URL unfurl="true"]https://oauth.openapi.it/counters/total"[/URL]
    With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", APICall, False
        .setRequestHeader "Authorization", "Basic " & PASSWORD
        .send
        STRINGA = .responseText

    End With

End Sub

this code return a STRINGA from .responseText, similar:

{"data":{"GET:eek:auth.openapi.it\/counters":{"counter":22,"paid":0,"limit":false},"GET:eek:auth.openapi.it\/scopes":{"counter":6,"paid":0,"limit":false},"POST:eek:auth.openapi.it\/token":{"counter":1,"paid":0,"limit":false},"GET:imprese.openapi.it\/advance":{"counter":14,"paid":0,"limit":false},"GET:imprese.openapi.it\/base":{"counter":2,"paid":0,"limit":false}},"success":true,"message":"","error":null}

how to retrive the values of json key counter?

for example:
counters/counter=22
scopes/counter=6
token/counter=1
ecc...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top