Accessing Podio from vba (Excel/Word)

Comments

9 comments

  • Andreas Haugstrup Pedersen

    Hi Markus,

    It looks like you are sending the OAuth2 access token as a URL query string parameter. It needs to be sent as an HTTP header.

    /Andreas

    1
    Comment actions Permalink
  • Markus Reuter

    Hi Andreas,
    thanks for the answer.
    Now I get data! (Jippii) :-)
    regards
    Markus

    1
    Comment actions Permalink
  • Leee Jeffries

    Hey, Would you mind posting your completed code?

    I got the first section to work as you did, Could you please post the latter bit of code to get the items?

    Regards

    Leee

    1
    Comment actions Permalink
  • Laura Hotalling

    For anyone else having trouble, there's a problem parsing the response from OAuthAppAuthorization:

    result = winHttpReq.responseText
    token_pos = InStr(result, "access_token")
    access_token = Mid(result, token_pos + 15)
    token_pos = InStr(access_token, Chr(34))
    access_token = Mid(access_token, 1, token_pos)

    This is including the double-quote when setting the access_token variable, which isn't a valid access token.

    For example, running OAuthAppAuthorization returns this:

    {"access_token":"12345","expires_in".....

    The code above sets the access_token variable to: 12345" (including the double-quote)

    Here's the fix:

    token_pos = InStr(access_token, Chr(34)) -1

     

    1
    Comment actions Permalink
  • Stéphane Aubert

    You can use "SetRequestHeader " to send the header... The following code is able to get the item :

    Function GetItems(app_id As String)
    Dim result As String
    Dim myURL As String
    Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    myURL = "https://api.podio.com/item/app/" & app_id
    winHttpReq.Open "GET", myURL, False
    winHttpReq.SetRequestHeader "Authorization", "OAuth2 " & access_token
    winHttpReq.Send
    result = winHttpReq.responseText
    GetItems = result
    End Function

    0
    Comment actions Permalink
  • Simon Beckham

    This is not quite working for me yet!

    The first section of code seems to work just fine, I can trigger a message box giving the API credentials.

    The second section returns an error saying "Invalid Authorization Header" using Stephane's code.

    I've tried amending but am struggling! Does anyone have any thoughts?

    Podio is great, and I know Globiflow could probably deal with what I need, but it's not going to happen due to the cost! It would be great for Power Query/Power BI links to be available too.

    This post seems to offer the best solution but not quite there yet!

     

     

    0
    Comment actions Permalink
  • Simon Beckham

    Made some progress (I think!), error has changed from "Invalid Authorisation Header" to "expired token".

    Not sure what else to change?

     

     

    0
    Comment actions Permalink
  • Johnny Ortiz

    Can someone let me know where is the documentation for this? Connecting via VBA.

    Thanks

    0
    Comment actions Permalink
  • Steven behr

    Do I need to write this code in the VBA sheet where the data is or as a module?

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk