0

I'm getting Error: Request failed with status code 401 when trying to assign tasks. I use PUT and attask/api/v9.0/task/{task number}/assign and passing objID, objCode, username and password or my ApiKey as params. Fun thing is - it's working through Postman. But it doesn't work in my app deployed on Heroku. Requests with GET are working though...

Igor
  • 146
  • 2
  • 8

1 Answers1

1

You do not need the username parameter. Try just invoking PUT attask/api/v9.0/task/{task number}/assign?objCode=USER&objCode=<user UUID>&apiKey=<key>

Brian R
  • 785
  • 1
  • 6
  • 13
  • Hello Brian, I meant I tried using either credentials or API key. In both cases I'm getting `401` status. Get requests are working fine. I'm using axios: `axios.put('https://{domain}.attask-ondemand.com/attask/api/v9.0/task/{task number}/assign', { params })`; and params are { apiKey: ***, objID: ***, objCode: 'USER' } – Igor Feb 04 '19 at 17:50
  • 1
    I'm not familiar with axios, but I would consider that maybe it's botching the call somehow. Can you have it print out the actual HTTP request it's sending and look at it manually? I usually get a 401 error when my parameters don't encode properly and it isn't able to read my API key. Maybe Axios is formatting PUTs weirdly if GETs are working OK? One last thing - the attask-ondemand.com is deprecated, so consider switching to .my.workfront.com when you can. – Brian R Feb 04 '19 at 18:30
  • You are right. The problem was in axios weird formatting of my PUT request parameters. I will switch to the .my.workfront.com. Thank you. – Igor Feb 04 '19 at 18:42