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

Create WorkItem with Author #54

Open
ptrushin opened this issue Aug 31, 2017 · 3 comments
Open

Create WorkItem with Author #54

ptrushin opened this issue Aug 31, 2017 · 3 comments

Comments

@ptrushin
Copy link

When I try to create WorkItem with Author field I get an exception

Response status code does not indicate success: 403 (Forbidden).

I think it is because method CreateWorkItemForIssue in YouTrackSharp.TimeTracking.TimeTrackingService call

rest/issue/{issueId}/timetracking/workitem

And in documentation api youtrack I see for this call that is has no author

https://www.jetbrains.com/help/youtrack/standalone/Create-New-Work-Item.html

I think it must be a call with author, described in

https://www.jetbrains.com/help/youtrack/standalone/Import-Workitems.html

but I can't find it in YouTrackSharp

@maartenba
Copy link
Contributor

Those are two different API's, the first one is the correct one.

403 effectively means forbidden, so may mean that the user you are creating a work item with has no permission to create a work item, or time tracking is not enabled. Note the work item should also have the correct work item type.

Do you have some more information? What is the call you are making? Do you have time tracking enabled for the project?

Check this unit test for an example:
https://github.com/JetBrains/YouTrackSharp/blob/master/tests/YouTrackSharp.Tests/Integration/TimeTracking/CreateWorkItemForIssue.cs

@ptrushin
Copy link
Author

ptrushin commented Sep 1, 2017

  1. About the first API - https://www.jetbrains.com/help/youtrack/standalone/Create-New-Work-Item.html - I think that if WorkItem has a constructor with Author I can fill this field. I get 403 only if I fill Author, in other cases all is ok. Ok, I don't fill Author for this API
  2. About the second API - https://www.jetbrains.com/help/youtrack/standalone/Import-Workitems.html -I need to fix time from other user, not from me, how can I do it with YouTrackSharp?

@maartenba
Copy link
Contributor

This is not possible yet. Author is always the user who is making the API call, the second API has not been implemented yet in YouTrackSharp (tracking issue #55)

Worst case if you need it now you can call the API manualy, the connection also exposes an HttpClient:

var client = await _connection.GetAuthenticatedHttpClient();

(and if you happen to go that route, a PR to resolve #55 is only a bit more work ;-))

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

2 participants