Steve Powell
Steve Powell

Reputation: 21

Workfront AtTask API Authentication Error

I am trying to query the Workfront REST Services from PowerShell

I am using a URL like this

https://ourcompany.attask-ondemand.com/attask/api/v4.0/project/search?apiKey=XYZetc

This returns JSON in both IE and Chrome and works in my Web Service tester.

All this runs behind a corporate proxy obviously.

The PowerShell I am using is

 $postResult = Invoke-RestMethod -Uri $URI -Method "GET" -Proxy
 http://internalproxyname:80  -ProxyUseDefaultCredentials

This fails with an Error

{"error":{"class":"com.attask.common.AuthenticationException","message":"You are not currently logged in"}}

This looks like an Error at the attask END not the proxy at our end (I get different errors running this as a non auth user or with mangled credentials passed to the Proxy

The docs suggest I don't need to be logged in if I was using an apiKey. I am not logged in in the browsers I am using (I don't even have a user account on the workfront instance)

I have trawled various blogs and stack answers to no avail. Can anyone point me in the right direction for figuring out what is going on? or what I might be doing wrong.

I have Enabled a trust all certs policy and set the validation callback to Ignore within the powershell

but equally I've tried this with these turned off and also investigated various properties on the ServicePointManager. I can produce any number of different errors/issues but the closest I get seems to be the above.

Oh and the Workfront API docs and examples being wrong didn't help me when I was getting started :-)

many thanks

Steve

Upvotes: 1

Views: 1183

Answers (1)

Steve Powell
Steve Powell

Reputation: 21

OK this was me being stupid. There was a bug in the code generating the URI (an extra slash) and the attask default error response is auth error not mangled request.

For reference the URL needs to be in the form shown in my original post. Don't miss off the api version number and don't use a port number as the code samples show.

Always look for the simple things first (I should remember that)

Doh!

Upvotes: 0

Related Questions