Skip to content

Create Work Item failed because of type can not be replaced in url #259

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

Closed
conhua opened this issue Aug 12, 2019 · 4 comments
Closed

Create Work Item failed because of type can not be replaced in url #259

conhua opened this issue Aug 12, 2019 · 4 comments

Comments

@conhua
Copy link

conhua commented Aug 12, 2019

/_apis/wit/workItems/${type}

When I call create work item, type is not replaced by the parameter

KeyError Traceback (most recent call last)
in
----> 1 work_item_client.create_work_item(document=document, project='Cognitive Services', type='Task')

~\AppData\Local\Continuum\anaconda3\lib\site-packages\azure\devops\released\work_item_tracking\work_item_tracking_client.py in create_work_item(self, document, project, type, validate_only, bypass_rules, suppress_notifications, expand)
1082 query_parameters=query_parameters,
1083 content=content,
-> 1084 media_type='application/json-patch+json')
1085 return self._deserialize('WorkItem', response)
1086

~\AppData\Local\Continuum\anaconda3\lib\site-packages\azure\devops\client.py in _send(self, http_method, location_id, version, route_values, query_parameters, content, media_type, accept_media_type, additional_headers)
75 location_id=location_id,
76 route_values=route_values,
---> 77 query_parameters=query_parameters)
78 negotiated_version = self._negotiate_request_version(
79 self._get_resource_location(location_id),

~\AppData\Local\Continuum\anaconda3\lib\site-packages\azure\devops\client.py in _create_request_message(self, http_method, location_id, route_values, query_parameters)
130 logger.debug('Route template: %s', location.route_template)
131 print(url)
--> 132 request = ClientRequest(method=http_method, url=self._client.format_url(url))
133 if query_parameters:
134 request.format_parameters(query_parameters)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\msrest\service_client.py in format_url(self, url, **kwargs)
149 :param str url: The request URL to be formatted if necessary.
150 """
--> 151 url = url.format(**kwargs)
152 parsed = urlparse(url)
153 if not parsed.scheme or not parsed.netloc:

KeyError: 'type'

@conhua
Copy link
Author

conhua commented Aug 12, 2019

@tedchamb

@borost1
Copy link

borost1 commented Aug 12, 2019

Same issue here, with the following stack trace:
File "/Users/tboros/PycharmProjects/azuredevops/venv/lib/python3.7/site-packages/azure/devops/released/work_item_tracking/work_item_tracking_client.py", line 1085, in create_work_item media_type='application/json-patch+json') File "/Users/tboros/PycharmProjects/azuredevops/venv/lib/python3.7/site-packages/azure/devops/client.py", line 77, in _send query_parameters=query_parameters) File "/Users/tboros/PycharmProjects/azuredevops/venv/lib/python3.7/site-packages/azure/devops/client.py", line 129, in _create_request_message request = ClientRequest(method=http_method, url=self._client.format_url(url)) File "/Users/tboros/PycharmProjects/azuredevops/venv/lib/python3.7/site-packages/msrest/service_client.py", line 152, in format_url url = url.format(**kwargs) KeyError: 'type'
The service client receives the following: /project/_apis/wit/workItems/${type}

Really tried several things to fix this issue, yet none found.

@tedchamb

@tedchamb
Copy link
Member

Thanks for reporting, fixed in #258

@tedchamb
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants