Is it possible to get a list of sprints for a particular project ? I know there is a way to find issues by a sprint, but haven't found any way to get all the sprints.
I use the following rest call to find all the sprints:
https://yourjira.com/rest/greenhopper/1.0/integration/teamcalendars/sprint/list?jql=project+%3D+YOURPROJECTKEY
To find only the open sprint of the project I run this:
https://yourjira.com/rest/greenhopper/1.0/integration/teamcalendars/sprint/list?jql=project+%3D+YOURPROJECTKEY+and+Sprint+not+in+closedSprints()
In JQL it's not yet possible but you can use the new jira agile API. Here is the documentation for jira cloud and for jira server 7.2.3.
First, you need to find the board of your project. This REST endpoint to get the list of your boards is:
[jira-url]/rest/agile/1.0/board
Next you can get their project with:
[jira-url]/rest/agile/1.0/[board-id]/project
So in this manner you can find the board id of your project. At the end, you can get the sprints list of this board with:
[jira-url]/rest/agile/1.0/[board-id]/sprint
[jira-url]/rest/greenhopper/1.0/sprint/picker
Delivers "allMatches" array containing active sprints including id and boardName.
It was useful to me when i was searching a list of active sprints in all projects to clean up not completed or not well named sprints.
Based on this answer: answers.atlassian.com/questions/65920/answers/3599592, the best Web API to get the list of sprints is:
https://<your_site>/rest/greenhopper/1.0/sprintquery/<rapidBoardId>?includeFutureSprints=true&includeHistoricSprints=false
<rapidBoardId> is different in each system, I just saw it in the address bar of my browser when I was surfing in JIRA, then I hard coded it into the code which is calling the API.
https://<your_site>/secure/RapidBoard.jspa?rapidView=<rapidBoardId is here on your browser address bar>
There is no REST endpoint to do this, you can only query the sprints that are visible for a particular Rapid Board and you need to use the GreenHoppper plugin for this.
The endpoint for that is: https://yourjira.com/rest/greenhopper/1.0/sprints/{rapidBoardId}
You can enumerate the Rapid Boards at another REST endpoint: https://yourjira.com/rest/greenhopper/1.0/rapidviews/list
Read more here: https://answers.atlassian.com/questions/65920/how-can-i-list-all-sprints-from-greenhopper-using-the-rest-api
I did not invent this, a colleague did. However, you can easily access all of the sprints in the "search issues" screen by using this JQL: Sprint is not EMPTY
That's it. Enjoy.
There is no straightforward solution, only workarounds. What is ridiculous why Jira doesn't provide such API calls.
You can use this endpoint:
https://api.atlassian.com/ex/jira/{cloudId}/rest/api/2/jql/autocompletedata/suggestions?fieldName=Sprint&fieldValue=
Take notice of whitespace character on the end of query. It implies that every name of sprint includes whitespace char inside.
Output:
{
"results": [
{
"value": "2",
"displayName": "Sprint 4 - 2020-06-17 04:00 (12)"
},
{
"value": "1",
"displayName": "Sprint 2 - 2020-06-20 06:45 (6)"
}
}
Have you looked at the sprint report? The dropdown will show you a list of all sprints for that board. Of course you can have multiple boards per project, so you might need to search all related boards.
Here is my solution.
call rest/api/2/search?jql=project%20%3D%20ABCD%20AND%20Sprint%20in%20openSprints() to get the issues in current active sprint. Then you could get the active sprint.
make another call rest/api/2/search?jql=Sprint%20%3D%2014343 to get the issues.
Below the code to parse the active sprint.
fetch(sprintUrl, {
headers: requestHeader,
})
.then((res) => res.json())
.then((data) => {
const regex = new RegExp("state=ACTIVE");
let activeSprint = data.issues[0].fields.customfield_14400.filter(
(e: string) => regex.test(e)
)[0];
const sprintParser =
/id=(\d+).*?name=(.*?),startDate=([\d-]+).*?endDate=([\d-]+)/g;
const group = [...activeSprint.matchAll(sprintParser)][0];
setSprint(
Object.create({
id: parseInt(group[1]),
name: group[2],
startDate: group[3],
endDate: group[4],
})
);
});
Related
I am trying to follow this youtube tutorial.
I am getting stuck at inserting the first piece of data. Ania demonstrates it at 20.46 as follows:
mutation insertGenres {
action: insertreference_list(value: {label: "genre", value: "action"}) {
value{
value
},
}
When I try this, I get an error that says:
{
"errors": [
{
"message": "Validation error of type FieldUndefined: Field 'insertreference_list' in type 'Mutation' is undefined # 'insertreference_list'",
"locations": [
{
"line": 2,
"column": 3
}
],
"extensions": {
"classification": "ValidationError"
}
}
]
}
When I google the error, a lot of responses tell people to use mutations instead of queries - but I've started from a mutation. I would like to know how to resolve the error, but I'd also like to find the skills to improve my search strategy for finding answers.
When I look at the documentation for using GraphQL with DataStax, I see a different format to the write structure, which is as follows:
insertbook(value: bookInput!, ifNotExists: Boolean, options:
UpdateOptions): bookMutationResult
It has a colon and a fragment of text after it. It also explicitly states the ifNotExists: Boolean and options. I don't know if there may have been a change to how to use DataStax since the time Ania recorded the tutorial that means it is no longer a current demonstration of how to use the tool, or if there is an answer for this and I just haven't found it yet.
You didn't provide details of how you've configured your Astra DB for Ania's Netflix Clone tutorial so I'm going to assume that you've named your keyspace as netflix.
It seems as though you haven't followed the instructions correctly and have missed steps. I can replicate the error you reported if I skip at least one of the steps in the tutorial.
In step 5 of the tutorial, you needed to do the following:
✅ In graphQL playground, change tab to now use graphql. Edit the end of the URl to change from system to the name of your keyspace: netflix
✅ Populate HTTP HEADER variable x-cassandra-token on the bottom of the page with your token as shown below (again !! yes this is not the same tab)
Switch tabs
In order to insert data, you need to switch to the graphql tab.
If you try to insert the data in the graphql-schema tab, you will get the error you reported.
Set keyspace
You need to update the URI of your GraphQL playground in the graphql tab to use the keyspace name netflix instead of system. For example:
https://db_id-us-west1.apps.astra.datastax.com/api/graphql/system
change to:
https://db_id-us-west1.apps.astra.datastax.com/api/graphql/netflix
If you try to insert data into the system keyspace, you will get the error you reported because the reference_list table does not exist in that keyspace. Cheers!
I created teams in Microsoft Teams (from groups as documented here) via the C# graph-api sdk without any problems - everything was working just fine.
But suddenly this is not working anymore. I will always get the following exception at the line return await graphServiceClient.Teams.Request().AddAsync(team);:
Message: Failed to execute Templates backend request
CreateTeamFromGroupWithTemplateRequest. Request Url:
https://teams.microsoft.com/fabric/emea/templates/api/groups/theGroupId/team,
Request Method: PUT,
And further:
Team Visibility can not be specified as it is inherited from the
group.
I know that the visibility property must not be set if creating the team from a group as it states in the Microsoft documentation:
The team that's created will always inherit from the group's display name, visibility, specialization, and members. Therefore, when making this call with the group#odata.bind property, the inclusion of team displayName, visibility, specialization, or members#odata.bind properties will return an error.
But the currently used code below shows that I am not setting any forbidden properties - and this code worked for the last few days, too:
private async Task<Team> CreateTeamFromGroup(string groupId)
{
var graphServiceClient = [...]
var groupResourceLink = $"https://graph.microsoft.com/v1.0/groups('{groupId}')";
var team = new Team
{
AdditionalData = new Dictionary<string, object>()
{
{ "template#odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('standard')" },
{ "group#odata.bind", groupResourceLink }
},
Channels = new TeamChannelsCollectionPage
{
new Channel
{
DisplayName = "WhatEver"
}
}
};
return await graphServiceClient.Teams.Request().AddAsync(team);
}
Is anyone else experiencing this problem? Was there an API change? Was the teams backend changed? Anyone any ideas?
P.S.: I am using the latest NuGet-Package for Microsoft Graph - downgrading didn't help.
Update (with a not very satisfying work-around)
The error can be reproduced via the graph api explorer, too.
The POST command above issues a PUT command, that is described here. With this request, the team can be created.
The documentation and the graph api snippet for C# is out-dated, though. You have to add odatatype = null to the properties when using the sdk
Unfortunately it is not possible to add channels in the same step. If you specify the property 'channels' it will just be ignored.
Update (Detailed error message)
System.AggregateException: 'One or more errors occurred. (Code:
BadRequest Message: Failed to execute Templates backend request
CreateTeamFromGroupWithTemplateRequest. Request Url:
https://teams.microsoft.com/fabric/emea/templates/api/groups/theGroupId/team,
Request Method: PUT, Response Status Code: BadRequest,
ErrorMessage : {"errors":[{"message":"Team Visibility can not be
specified as it is inherited from the
group."}],"operationId":"639448e414ece64caee8f52839585bf7"} Inner
error: AdditionalData: date: 2020-11-24T10:21:22 request-id:
37a28cac-3ac5-4bd2-a061-daf44c442fac client-request-id:
37a28cac-3ac5-4bd2-a061-daf44c442fac ClientRequestId:
37a28cac-3ac5-4bd2-a061-daf44c442fac )'
Just tested this morning and I can say, that the "old way" by using the beta API to create a team with a template works again. Don't know, how many other ways exist to do these things, but here is our current request, that works now (again).
POST https://graph.microsoft.com/beta/teams
{
"displayName": "My Group Name",
"description": "Some description",
"template#odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",
"owners#odata.bind": [
"https://graph.microsoft.com/beta/users('<someValidUserId>')"
]
}
I think this will be just an intermediate state and when the bugs are fixed, they will publish the new version again and this kind of creation will fail again, but if in this case the v1.0 documented way will work this wouldn't be a big problem. But being informed BEFORE there roll-out starts would be great.
This was a Microsoft issue/ bug and is currently being fixed as stated here.
I have embedded power bi report in my asp.net mvc application. It is working fine and it is showing data. I am having one issue, in my application every client has few branches like cities. Every user for that client may have access to all or some branches and based on that access we show data when that user is logged into system.
I want to achieve same in power bi that when user is logged into system and view reports it should show him/her data of branch he/she has access to. I found one solution
[Can I pass a dynamic query parameter to an embedded Power BI report in ASP.Net MVC? where we can set filter values from program side. I applied this in my view but i am still getting all data.
const branchFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "tblWorkhistory",
column: "BranchID"
},
operator: "In",
values: [1],
filterType: models.FilterType.BasicFilter
}
var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedReportId,
permissions: models.Permissions.All,
viewMode: models.ViewMode.View,
filters: [branchFilter],
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
};
Here i want to apply filter where it will show data for only branch whose id is 1 but it is showing all data. Am i missing anything here? do i need to do anything report side also after this code?
Regards,
Savan
Applying filter using embed config is supported, and the code sample you've shared seems valid.
If report.setFilters fails as well, seems like something with the filter is wrong.
Try to verify the data type of the filter, should it be 1 or "1"?
If this doesn't work, is there any error message being returned from .setFilters request?:
const filter = { ... };
report.setFilters([filter])
.catch(errors => {
// Handle error
});
Learn more here about setting filters through JS SDK.
To show data based on the user logged into you application you have to apply Row Level Security (RLS) in your power bi report first and then follow the steps from following article https://learn.microsoft.com/en-us/power-bi/developer/embedded-row-level-security
I am retrieving some User Stories using the the VSTS / TFS Web API and the code below:
var getWorkItemsHttpRequestMessage = new HttpRequestMessage(new HttpMethod("GET"), uri + "/_apis/wit/workitems?ids=736,731&&api-version=4.1");
var getWorkItemsHttpResponse = client.SendAsync(getWorkItemsHttpRequestMessage).Result;
if (getWorkItemsHttpResponse.IsSuccessStatusCode)
{
var workItems = getWorkItemsHttpResponse.Content.ReadAsAsync<HttpWorkItems>().Result;
// ...
The query returns all the fields of the work items (user stories, in this case), but not the other items that is linked to them.
I would like to retrieve the Tasks related to these User Stories.
How can it be done ?
Is there another better way to do it ?
You can use the $expand parameter in the URL with the value relations:
https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/4?$expand=relations&api-version=4.1
In the results, you will get the work item links in the section relations:
"relations":[
{
"rel":"System.LinkTypes.Hierarchy-Forward",
"url":"https://dev.azure.com/shaykia/_apis/wit/workItems/5",
"attributes":{
"isLocked":false
}
In the example above, we check work item 4 in the API, and in the results, we can see that work item 5 linked to him with a type of System.LinkTypes.Hierarchy-Forward that work item 4 the parent of 5 (5 he is the child, a task in this case).
You can read here about the relations types.
I am trying to do a simple Salesforce-Asana integration. I have many functions working, but I am having trouble with adding a tag to a workspace. Since I can't find documentation on the addTag method, I'm sort of guessing at what is required.
If I post the following JSON to https://app.asana.com/api/1.0/workspaces/WORKSPACEID/tasks:
{"data":{"name":"MyTagName","notes":"Test Notes"}}
The tag gets created in Asana, but with blank notes and name fields. If I try to get a bit more fancy and post:
{"data":{"name":"MyTagName","notes":"Test Notes","followers":[{"id":"MY_USER_ID"}]}}
I receive:
{"errors":[{"message":"Invalid field: {\"data\":{\"name\":\"MyTagName\",\"notes\":\"Test Notes\",\"followers\":[{\"id\":\"MY_USER_ID\"}]}}"}]}
I'm thinking the backslashes may mean that my request is being modified by the post, though debug output shows a properly formatted json string before the post.
Sample Code:
JSONGenerator jsongen = JSON.createGenerator(false);
jsongen.writeStartObject();
jsongen.writeFieldName('data');
jsongen.writeStartObject();
jsongen.writeStringField('name', 'MyTagName');
jsongen.writeStringField('notes', 'Test Notes');
jsongen.writeFieldName('followers');
jsongen.writeStartArray();
jsongen.writeStartObject();
jsongen.writeStringField('id', 'MY_USER_ID');
jsongen.writeEndObject();
jsongen.writeEndArray();
jsongen.writeEndObject();
jsongen.writeEndObject();
String requestbody = jsongen.getAsString();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://app.asana.com/api/1.0/workspaces/WORKSPACEID/tags');
req.setMethod('POST');
//===Auth header created here - working fine===
req.setBody(requestbody);
Http http = new Http();
HTTPResponse res = http.send(req);
return res.getBody();
Any help appreciated. I am inexperienced using JSON as well as the Asana API.
The problem was that I was posting to the wrong endpoint. Instead of workspaces/workspaceid/tags, I should have been using /tags and including workspaceid in the body of the request.
Aha, so you can add tags and even set followers despite the API not mentioning that you can or claiming that followers are read-only.
So to sum up for anyone else interested: POSTing to the endpoint https://app.asana.com/api/1.0/tags you can create a tag like this:
{ "data" : { "workspace": 1234567, "name" : "newtagname", "followers": [45678, 6789] } }
where 1234567 is your workspace ID and 45678 and 6789 are your new followers.
Since you posted this question, Asana's API and developer has introduced Tags. You documentation lays out the answer to your question pretty clearly:
https://asana.com/developers/api-reference/tags
I'm a bit confused by your question. Your ask "how to add a tag" but the first half of your question talks about adding a task. The problem with what you describe there is that you are trying to set a task's followers but the followers field is currently read-only according to Asana's API documentation. That is why you are getting an error. You can not set followers with the API right now.
The second part of your question - with the sample code - does look like you are trying to add a tag. However, right now the Asana API does not support this (at least according to the API documentation). You can update an existing tag but you can't add one.
So, to sum up: at this time the API does not allow you to add followers to a task or to create new tags.