Add "Role" attribute to POST request for worklog in jira - post

I am trying to add a worklog via the jira api.I need only one more thing and that is how to add a Role to the worklog. I want the role to be "Developer"
My request is:
URL: https://{host}/rest/api/2/issue/{jiraticket}/worklog
Body: {
"comment": "Test",
"started": "2022-11-18T14:47:10.501+0000",
"timeSpent": "3h 15m",
}
Creating a worklog with this body works but I also need to add a role.
Is there any way to add this?

For Jira worklog, your endpoint and request is totally correct.
However, the log screen that you mentioned belongs to Tempo Timesheets Plugin; so the "Role" attribute is also belong to that plugin.
For creating a Tempo worklog, you can use Tempo Timesheets Rest API for creating worklog.

Related

Microsoft Graph API GET onlineMeeting via joinUrl

Current using Microsoft Graph API v1.0 to create onlineMeetings via POST /me/events. Reason being, if you create an onlineMeeting directly and add a user in the meeting, it doesn't create a calendar event.
The params I use for that call is:
:isOnlineMeeting => true,
:onlineMeetingProvider => "teamsForBusiness"
Which works great and returns a joinUrl under onlineMeetings.
However, I'd like to pull attendance data from the GET onlineMeeting route to get attendance information since the attendees section of the event only seems to return users that were added to the actual event, not who attended the actual onlineMeeting.
I have tried doing a get request like such:
/v1.0/me/onlineMeetings?$filter=joinWebUrl%20eq%20'https://whateverthejoinurlis'
but the response says it's not a valid filter.
Any guidance would be appreciated.
Posting the Answer for better knowledge
Copying from #Shiva Keshav Varma comments
Try it in beta version
/beta/me/onlineMeetings?$filter=joinWebUrl%20eq%20'https://whateverthejoinurlis
You can also get the attendeereport using beta/users/{userId}/onlineMeetings/{meetingId}/attendeeReport as specified in the document.

Is it possible to set permissions on variable groups via the REST API?

I was curious if anyone knows how to set permissions (add/remove groups) to variable groups via the REST API. I know there is the security namespace, however it requires a resource guid and I am not sure how to get that for a specific variable group?
You want security namespace "Library" ( you need to convert it to proper namespace_id ) and with token "Library/$project_id/VariableGroup/$variable_group_id"
POST https://dev.azure.com/{organization}/_apis/accesscontrollists/{securityNamespaceId}?api-version=5.1
For ACL management REST API see https://learn.microsoft.com/en-us/rest/api/azure/devops/security/access%20control%20lists/set%20access%20control%20lists?view=azure-devops-rest-5.1
Example request:
"value": [
{
"inheritPermissions": true,
"token": "Library/$project_id/VariableGroup/$variable_group_id",
"acesDictionary": {
"Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-1": {
"descriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-1",
"allow": 31,
"deny": 0
}
}
}
]
Warning1 - At the moment the Microsoft doc on that topic is quite incomplete ( see, for example my comment on github issue asking for clarification of variables groups authentication mechanism ).
Warning2 - Be careful with ACL changing requests for ALL variable groups in project ( e.g. token=Library/$project_id/ ), because you might end up with removing permissions from all users on your Ado project and it's could be hard to change it back.
I am afraid it is not possible to set variable groups permission via api.
There is only group id we can get from variable group api below, no resource id in the response.
https://dev.azure.com/{organization}/{project}/_apis/distributedtask/variablegroups?api-version=5.1-preview.1
When i tried fetching the http request trace with F12 chrome. There is a value at the end of request url looks like the source id. And it is the project id combined with the variable group id. Donot know if this is resource guid you were looking for.
https://dev.azure.com//_apis/securityroles/scopes/distributedtask.variablegroup/roleassignments/resources/39e13f04-cb4e-4fa8-b2f1-0ee8f4fc82c5%241
I managed to reverse engineer who to do this. If anyone is curious on how it works feel free to talk a look at the powershell library for Azure DevOps I have put together -- https://github.com/ravensorb/Posh-AzureDevOps

How to connect Jira Cloud data to a web-app

I have a node.js web-app added to jira as user-installed app.
My app has some simple data:
{name: process_1},
{name: process_2},
{name: process_3}
What I need to do is:
Add a custom field named "tl_process" to the New Issue jira form
Have tl_process field list all the data from my app, eg: "process_1", "process_2", "process_3" as selectable values
2.1 Important note: these values should be supplied to jira by my webapp
When a user creates new jira issue with tl_process value process_2 for example - my webapp should receive a notification about it. Then I will set my data to:
{name: process_1, active: true}
What would be the best course of action to follow here?
Add a custom field named "tl_process" to the New Issue jira form
If you want the field to be seen in the issue view, you might want to consider using the Issue Field module. If you really want a custom field, check the REST API here.
Have tl_process field list all the data from my app, eg: "process_1", "process_2", "process_3" as selectable values
If you go the Issue Field route, you can also add values by using Create issue field option REST API.
When a user creates new jira issue with tl_process value process_2 for example - my webapp should receive a notification about it. Then I will set my data to:
For this, you need to create an endpoint on your app and trigger a webhook to call your app.

Fetch worklog results of a particular user

I want to get the total hours that every user has logged in, in a specific project every week.
In order to achieve this, I'm trying to get the whole worklog in the project, and then filter it by the worklog Author. This is the query I'm using:
https://jira.example.com/rest/api/2/search?startIndex=0&maxResults=100&jql=project=%27Test%20Project%27+and+worklogAuthor=testUser+and+updated%3E=-7d&fields=worklog
This brings back every issue that has been updated in the last 7 days, and the user is related to it. However, it also brings back the worklog of another user that has added time in the same issue for example.
My question is the following, is there a way to filter the query by name, and bring back the worklog of a particular user, without the worklogs of other users that are simply related to the same issue?
The query returns the results in a json format that look like this for every worklog of a user:
"worklogs": [
{
"author": {...}, // 8 items, where there's a 'name' field for the particular user
"updateAuthor": {...}, // 8 items
"comment": "",
"created": "2018-01-03T13:42:15.000+0200",
"updated": "2018-01-03T13:42:15.000+0200",
"started": "2018-01-03T13:42:00.000+0200",
"timeSpent": "1h",
"timeSpentSeconds": 3600,
"id": "10540",
"issueId": "10674"
},
Thanks
I don't think this is possible with jira out of the box. The jira rest api only supports retrieving work logs for issues, not users.
However, there are add-ons like Script Runner that provide additional JQL functions that allow you to query for issues where a specific user has logged work. You can easily execute such a JQL using the search REST API. This will give you a smaller list of issues/work logs to filter on.
Example JQL:
issueFunction in workLogged(on "2015/07/28" by admin)
More info about custom jql functions is available in the Script Runner documentation.
worklogAuthor = currentUser()
or
worklogAuthor = marc
might help you

JIRA REST API issue transitions and worklog (v4.4.1)

Is it possible to update the worklog for an issue when transitioning (i.e. POST to /rest/api/latest/issue/{issueid}/transitions) via the REST API for JIRA (API version is 2.0.alpha1 of JIRA v4.4.1)? I'm posting a worklog as part of the request and looking for the minimum information I need to send (currently just minutesSpent and started time as these seem to be the only mandatory ones via the UI).
i.e.
worklog:
{
name: "worklog",
type: "worklog",
value: [
{
started: "2012-10-01T10:28:00.000+1000",
minutesSpent: 480
}
]
},
Currently the post to the URL seems to just ignore this additional data although the transition does take effect with a desired 204 response.
From the JIRA REST API Docs:
The fields that can be set on transtion, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields resource. If a field is not configured to appear on the transition screen, then it will not be in the transition metadata, and a field validation error will occur if it is submitted.
If, in the response you get from the expansion, you don't see worklog, then I don't think it is possible.

Resources