Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project items are removed from the url when calling TFSAPI #55

Open
rtc116 opened this issue Oct 27, 2018 · 6 comments
Open

Project items are removed from the url when calling TFSAPI #55

rtc116 opened this issue Oct 27, 2018 · 6 comments
Labels
waiting for feedback Feedback from reporter is required. Issue will be closed otherwise.

Comments

@rtc116
Copy link

rtc116 commented Oct 27, 2018

I am specifying a Collection as well as a Project in the call to TFSAPI, however when I try to retrieve a work item there is a HTTPError: 401 Client Error: Unauthorized for url...However, I noticed that the project has been removed from the url and this could be causing the authentication error.
call to TFSAPI:

client = TFSAPI("https://tfsserver:8080/tfs/", project="CollectionName/ProjectName", user=user, password=password, auth_type=HttpNtlmAuth)
workitem = client.get_workitem(10)
Error:
...requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://tfsserver:8080/tfs/CollectionName/_apis/wit/workitems?ids=10&$expand=all&api-version=1.0

@SAnCherepan
Copy link
Contributor

AFAIK, project is not required for retrieving work items.
Try the link you provided in your web browser and see if you get JSON data or 401 error,

To help with your issue we might need some extra details:

  1. what TFS version are you using?
  2. are you using password or personal access token when initializing TFSAPI?

@allburov allburov added the waiting for feedback Feedback from reporter is required. Issue will be closed otherwise. label Oct 29, 2018
@rtc116
Copy link
Author

rtc116 commented Oct 29, 2018

I am using TFS 2018.2. The TFS module defaults to version=1.0 of the API which should work. I guess I could change the TFSAPI module code to change this, unless I can send the API version as an argument. I'm still curious why the Project is chopped from the url, and only the Collection name remains. Currently I am awaiting feedback from my organization about permissions on the collection.

@rtc116
Copy link
Author

rtc116 commented Oct 29, 2018

Also, when I paste the url to the web browser the following error is displayed - "Work item 10 does not exist, or you do not have permissions to read it."

@Boltyk
Copy link
Member

Boltyk commented Nov 3, 2018

@rtc116 401 means wrong user/password or personal access token. In my case I was unable to make it work with my user/password, but access token works well.
Work Item ID also supposed to be valid
You can generate user access token by yourself - https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=vsts

@Boltyk
Copy link
Member

Boltyk commented Apr 12, 2019

I believe this is not an issue.
Work items api don't have project name in the url.

https://docs.microsoft.com/en-us/azure/devops/integrate/previous-apis/wit/work-items?view=tfs-2015#get-a-work-item

@SAnCherepan
Copy link
Contributor

Also, when I paste the url to the web browser the following error is displayed - "Work item 10 does not exist, or you do not have permissions to read it."

@rtc116, then it is not the library's, issue.

  1. Make sure Work Item 10 exists. Or use any other WI that exists.
  2. Make sure the account you use for the API has access rights and can see that WI in the web browser without any errors.

Only then will you be able to see if the library actually works or not.
Let us know if you have any problem after these steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Feedback from reporter is required. Issue will be closed otherwise.
Development

No branches or pull requests

4 participants