0

I'm trying to get data from one report with VBA in Excel.

I get this error message:

{"data":{"message":"Request method 'GET' not supported","code":3000}}

This is my code:

Dim strUrl As String
        strUrl = "https://api.clockify.me/api/workspaces/{workspaceId}/reports/{reportId}/"

Set hReq = CreateObject("MSXML2.XMLHTTP")
    With hReq
        .Open "GET", strUrl, False
        .SetRequestHeader "X-api-key", "{api-key}"
        .SetRequestHeader "content-type", "application/json"
        .Send
    End With

'wrap the response in a JSON root tag "data" to count returned objects
Dim response As String
    response = "{""data"":" & hReq.ResponseText & "}"
    Debug.Print response

Why is the GET method not allowed here?

Community
  • 1
  • 1

1 Answers1

0

Looking at the documentation (https://clockify.github.io/clockify_api_docs/#tag-Report)... I don't see a "GET /workspaces/{workspaceId}/reports/{reportId}/" API call - the closes is either GET /reports/{reportId} or PUT/DELETE /workspaces/{workspaceId}/reports/{reportId}, which would explain why you are getting the "GET not allowed", because you can only PUT or DELETE to the /workspaces/{workspaceId}/reports/{reportId}/ endpoint. I'm guessing you want the "GET /reports/{reportId}". Try that.

And I'm guessing this GET /reports/{reportId} isn't under workspaces because reports can be made public... but that's just a guess.