Forum Discussion

russb's avatar
3 months ago

Access Denied

Hello

I am trying to GET a list of items.
I use the following code to successfully retrieve the company endpoints...

 

   sURL = "https://api.myob.com/accountright/[Company File GUID]"
   With objHTTP
    .Open "GET", sURL, False
    .setRequestHeader "Accept", "application/json"
    .setRequestHeader "Authorization", "Bearer " & gsMYOBToken
    .setRequestHeader "x-myobapi-key", idsMYOBClientId
    .setRequestHeader "x-myobapi-version", "v2"
    .setRequestHeader "x-myobapi-cftoken", fEncodeBase64(gsMYOBUsername & ":" & gsMYOBPassword)
    .setRequestHeader "Accept-Language", "en"
    .send
    resptext = .responseText
    End With

(note: the above works)

 

Using the same code with a new endpoint I get 'Access Denied'...

sURL = "https://api.myob.com/accountright/[Company File GUID]/Inventory/Item"

Can anyone offer what is missing or in error with the code to fix this issue?

 

Many thanks

Russ

  • For anyone interested, the following worked...

     

            .Open "GET", sURL, False
            .setRequestHeader "Accept", "application/json"
            .setRequestHeader "Authorization", "Bearer " & gsMYOBToken
            .setRequestHeader "x-myobapi-tenantid", gsMYOBTenantId
            .setRequestHeader "x-myobapi-version", "v2"
            .setRequestHeader "x-myobapi-key", idsMYOBClientId
            .send
            resptext = .responseText