how to filter Defect search by active projects in Rally using Web API - rally

I built a custom search tool to allow searching Rally via the Web API from other applications and I've run into an issue. Right now I am allowing defects to be searched but I noticed that defects are coming back in the search results that are related to a project that is closed. I need to filter these out. I am wondering if there is a way to access attributes on a referenced object when querying another object, for example, if I have a query to search for defects where the name contains some text, such as https://rally1.rallydev.com/slm/webservice/v2.0/defect?query=(Name contains "keyword"), can I include something in that query to say that I only want defects for open projects by using the Project attribute on Defect, such as Project.State equals "Open". Basically I'm wondering if there is a way to do it in one query in an OData-ish format. Or as an alternative, if I separately query for a list of all open projects, could I add conditions to the query to say something like (Name contains "keyword") AND (ProjectId = ... OR ProjectId OR ...)? Any thoughts or suggestions are much appreciated.

A query for defects (or any other work item types) is not expected to return items from closed projects. WS API queries do not search closed projects.
Created a defect in a project. It happens to have FormattedID DE529
Tested (FormattedID = DE529) in WS API.
This json was returned:
{
QueryResult: {
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
Errors: [ ],
Warnings: [ ],
TotalResultCount: 1,
StartIndex: 1,
PageSize: 20,
Results: [
{
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
_ref: "https://rally1.rallydev.com/slm/webservice/v2.0/defect/36182496495",
_refObjectUUID: "aa35839a-5e49-44c6-8be7-2fb17bbd91bf",
_refObjectName: "bad defect",
_type: "Defect"
}
]
}
}
Closed the project. Ran the same query:
No result:
{
QueryResult: {
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
Errors: [ ],
Warnings: [ ],
TotalResultCount: 0,
StartIndex: 1,
PageSize: 20,
Results: [ ]
}
}
Also, it is not possible to query Projects by State. This query will return 0 results even when there are closed projects in the workspace 1234:
https://rally1.rallydev.com/slm/webservice/v2.0/project?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12345&query=(State = Closed)
Project names in Rally do not have to be unique. Identifying a project by Name may produce a misleading result in a corner case when you have two projects with the same name(one is Open, the other is Closed).

Related

Collapsing a group using Google Sheets API

So as a workaround to difficulties creating a new sheet with groups I am trying to create and collapse these groups in a separate call to batchUpdate. I can call request an addDimensionGroup successfully, but when I request updateDimensionGroup to collapse the group I just created, either in the same API call or in a separate one, I get this error:
{
"error": {
"code": 400,
"message": "Invalid requests[1].updateDimensionGroup: dimensionGroup.depth must be \u003e 0",
"status": "INVALID_ARGUMENT"
}
}
But I'm passing depth as 0 as seen by the following JSON which I send in my request:
{
"requests":[{
"addDimensionGroup":{
"range":{
"dimension":"ROWS",
"sheetId":0,
"startIndex":2,
"endIndex":5}
}
},{
"updateDimensionGroup":{
"dimensionGroup":{
"range": {
"dimension":"ROWS",
"sheetId":0,
"startIndex":2,
"endIndex":5
},
"depth":0,
"collapsed":true
},
"fields":"*"
}
}],
"includeSpreadsheetInResponse":true}',
...
I'm not entirely sure what I am supposed to provide for "fields", the documentation for UpdateDimensionGroupRequest says it is supposed to be a string ("string ( FieldMask format)"), but the FieldMask definition itself shows the possibility of multiple paths, and doesn't tell me how they are supposed to be separated in a single string.
What am I doing wrong here?
The error message is actually instructing you that the dimensionGroup.depth value must be > 0:
If you call spreadsheets.get() on your sheet, and request only the DimensionGroup data, you'll note that your created group is actually at depth 1:
GET https://sheets.googleapis.com/v4/spreadsheets/{SSID}?fields=sheets(rowGroups)&key={API_KEY}
This makes sense, since the depth is (per API spec):
depth numberThe depth of the group, representing how many groups have a range that wholly contains the range of this group.
Note that any given particular DimensionGroup "wholly contains its own range" by definition.
If your goal is to change the status of the DimensionGroup, then you need to set its collapsed property:
{
"requests":
[
{
"updateDimensionGroup":
{
"dimensionGroup":
{
"range":
{
"sheetId": <your sheet id>,
"dimension": "ROWS",
"startIndex": 2,
"endIndex": 5
},
"collapsed": true,
"depth": 1
},
"fields": "collapsed"
}
}
]
}
For this particular Request, the only attribute you can set is collapsed - the other properties are used to identify the desired DimensionGroup to manipulate. Thus, specifying fields: "*" is equivalent to fields: "collapsed". This is not true for the majority of requests, so specifying fields: "*" and then omitting a non-required request parameter is interpreted as "Delete that missing parameter from the server's representation".
To change a DimensionGroup's depth, you must add or remove other DimensionGroups that encompass it.

Is there a way to schedule assignments in google classroom API

Is there a way one can schedule assignments using classroom API?
As of now you can't set the schedule of when the assignment should be published through the API. There are a couple of open issues on apps-api-issues 4730 and 5262 stating this problem. You can star that issue and will be notified as soon as any changes occur. One work around might be is to set the state attribute to DRAFT until needing to change the state to PUBLISHED.
POST https://classroom.googleapis.com/v1/courses/{courseId}/courseWork
{
"courseId": string,
"id": string,
"title": string,
"description": string,
"materials": [
{
object(Material)
}
],
"state": enum(CourseWorkState),
"alternateLink": string,
"creationTime": string,
"updateTime": string,
"dueDate": {
object(Date)
},
"dueTime": {
object(TimeOfDay)
},
"maxPoints": number,
"workType": enum(CourseWorkType),
"associatedWithDeveloper": boolean,
"submissionModificationMode": enum(SubmissionModificationMode),
// Union field details can be only one of the following:
"assignment": {
object(Assignment)
},
"multipleChoiceQuestion": {
object(MultipleChoiceQuestion)
},
// End of list of possible types for union field details.
}
Fields
Update as of 21 June 2017, the API has been updated to allow the setting of a scheduled time (https://developers.google.com/classroom/reference/rest/v1/courses.courseWork) using the scheduledTime field of the CourseWork.
This issue has now been marked as Fixed.

Possible to use angular-datatables with serverside array sourced data instead of object sourced data

I'm trying to use angular-datatables with serverside processing. However, it seems that angular-datatables expects that the data from the server is in object format (object vs array data described) with column names preceding each table datapoint. I'd like to configure angular-datatables to accept array based data since I can't modify my server side output which only outputs data in array format.
I'm configuring Datatables in my javascript like so:
var vm = this;
vm.dtOptions = DTOptionsBuilder.newOptions()
.withOption('ajax', {
url: 'output/ss_results/' + $routeParams.uuid,
type: 'GET'
})
.withDataProp('data')
.withOption('processing', true)
.withOption('serverSide', true);
My data from the server looks like this in array format:
var data = [
[
"Tiger Nixon",
"System Architect",
"$3,120"
],
[
"Garrett Winters",
"Director",
"$5,300"
]
]
But as far as I can tell, angular-datatables is expecting the data in object format like so:
[
{
"name": "Tiger Nixon",
"position": "System Architect",
"extn": "5421"
},
{
"name": "Garrett Winters",
"position": "Director",
"extn": "8422"
}
]
I tried not defining dtColumns or setting it to an empty array like vm.dtColumns = []; but I get an error message when I do that. When I configure dtColumns with a promise to load the column data via ajax I get datatables error #4 because it can't find the column name preceding my table datapoints in the data retrieved from the server.
Is it possible to configure angular-datatables to accept array based data? I can't find anything on the angular-datatables website that indicates it can be configured this way.
Edit: So I removed the .withDataProp('data') which I think was causing the problem. The table works a little better now but it's still broken. After it loads, I get the message No matching records found. Even though right below it it says Showing 1 to 10 of 60,349 entries
Previous1…456…6035Next Does anyone know why this might be?
If you want to use an array of arrays instead of an array of objects, simply refer to the array indexes instead of the object names :
$scope.dtColumns = [
DTColumnBuilder.newColumn(0).withTitle('Name'),
DTColumnBuilder.newColumn(1).withTitle('Position'),
DTColumnBuilder.newColumn(2).withTitle('Office'),
DTColumnBuilder.newColumn(3).withTitle('Start date'),
DTColumnBuilder.newColumn(4).withTitle('Salary')
]
demo using the famous "Tiger Nixon" array loaded via AJAX -> http://plnkr.co/edit/16UoRqF5hvg2YpvAP8J3?p=preview

Ravendb 2.5: query giving 0 results while it should be 1

I've got a problem with a query I can't figure out, I'm doing this query in code:
var userList = (from user in this.documentSession.Query<User>()
where user.FederatedUserIds[authenticatedClient.ProviderName] == authenticatedClient.UserInformation.Id
select user).ToList();
In this case the providername is facebook and the id = 100001103765630. The FederatedUserId's is a Dictionary.
Which results in this query to the server:
http://localhost:8080/indexes/dynamic/Users?&query=FederatedUserIds.facebook%3A100001103765630&pageSize=128
Which gives zero results, also from a query in the webbrowser:
{
"Results": [],
"Includes": [],
"IsStale": false,
"IndexTimestamp": "2013-08-24T14:52:44.0511623Z",
"TotalResults": 0,
"SkippedResults": 0,
"IndexName": "Auto/Users/ByFederatedUserIds_facebook",
"IndexEtag": "01000000-0000-0064-0000-000000000001",
"ResultEtag": "2BD9AA1E-935A-FEDF-3636-FAB0F155ED9E",
"Highlightings": {},
"NonAuthoritativeInformation": false,
"LastQueryTime": "2013-08-24T15:00:30.1200358Z",
"DurationMilliseconds": 1
}
While I have a document that's like this in the database, so I expect 1 result instead of 0:
{
"DisplayName": "neographikal",
"RealName": "x",
"Email": "x",
"PictureUri": "x",
"Roles": [
"User"
],
"ProfileImages": [],
"FederatedUserIds": {
"google": "x",
"twitter": "x",
"windowslive": "x",
"linkedin": "x",
"facebook": "100001103765630"
}
}
The strange thing is, this has never bothered me before in this piece of code. Can somebody see where I'm doing this wrong?
I was going to say that you might have stale results, but I see that "IsStale": false.
The only other thing I see is that the query on the URL comes through as FederatedUserIds.facebook while the field name is going to be FederatedUserIds_facebook in the index. However, I tested this and it worked, so it appears that the . is translated to _ before the query executes. I'm not sure when this was added or if it's always been that way.
Note if you try to query with . in Raven Studio, it doesn't work there, but _ does.
What build version are you running? I tested on 2.5.2666 and it worked for me.
Somehow, this was related to the indexes. Although it was a auto indexed query, deleting all the indexes on the server and rebooting the application solved the problem. I don't think this should have happened, but reproducing it seemed very difficult. If I can reproduce it in the feature, I'll try to investigate this further.
edit 01-09:
Found the problem and created a bug report: http://issues.hibernatingrhinos.com/issue/RavenDB-1334
Worked around it by creating a decent index:
public class UserByFederatedLoginIndex : AbstractIndexCreationTask<Core.Domain.User>
{
public UserByFederatedLoginIndex()
{
Map = users => from u in users
select new
{
u.DisplayName,
_ = u.FederatedUserIds.Select(x => CreateField("FederatedUserIds_"+x.Key, x.Value))
};
}

Lookback API: Deleted items

I'd like to use the lookback API to view the history of a deleted object, which I think should be simple if I know the formatted id. I just need to query:
{ FormattedID: 'DEXXXX' }
But does the Lookback API record anything special for when an object is deleted (like can I tell exactly when it was deleted or by whom)? Can it help point me to the correct place in the Recycle bin so that I could try to undelete it?
If you know the specific FormattedID, you can just query for its history, as you mentioned above. There isn't a special indicator that a snapshot represents the last valid state before a deletion, but the _ValidTo date will have been changed from the apoc (9999-01-01) to the date and time it was deleted. Unfortunately, the _User field of that last snapshot will be of the person that caused the last change to the object (before deletion), since we don't record a snapshot for when we delete.
Interesting. I just ran a REST query on the Recycle Bin with fetch=true and got back a lot more data on the result set than I'm used to:
GET https://rally1.rallydev.com/slm/webservice/1.40/recyclebinentry/12345678914.js
{ "RecycleBinEntry" : { "DeletedBy" : { "_rallyAPIMajor" : "1",
"_rallyAPIMinor" : "40",
"_ref" : "https://rally1.rallydev.com/slm/webservice/1.40/user/12345678910.js",
"_refObjectName" : "User One",
"_type" : "User"
},
"DeletionDate" : "2012-05-15T02:53:10.087Z",
"Errors" : [ ],
"ID" : "DE32",
"Name" : "Error found in TC43: TC07-011",
"ObjectID" : 12345678911,
"Subscription" : { "_rallyAPIMajor" : "1",
"_rallyAPIMinor" : "40",
"_ref" : "https://rally1.rallydev.com/slm/webservice/1.40/subscription/12345678912.js",
"_refObjectName" : "My Subscription",
"_type" : "Subscription"
},
"Type" : "Defect",
"Warnings" : [ ],
"Workspace" : { "_rallyAPIMajor" : "1",
"_rallyAPIMinor" : "40",
"_ref" : "https://rally1.rallydev.com/slm/webservice/1.40/workspace/12345678913.js",
"_refObjectName" : "My Workspace",
"_type" : "Workspace"
},
"_CreatedAt" : "May 14, 2012",
"_objectVersion" : "1",
"_rallyAPIMajor" : "1",
"_rallyAPIMinor" : "40",
"_ref" : "https://rally1.rallydev.com/slm/webservice/1.40/recyclebinentry/12345678914.js",
"_refObjectName" : "Error found in TC43: TC07-011"
}
}
I didn't realized Rally released an enhancement to this information, but this data includes the Name and Ref of the User that deleted the Object.
You can walk the Recycle bin of the current Workspace/Project using this REST URL:
https://rally1.rallydev.com/slm/webservice/1.40/recyclebin.js?workspace=/workspace/12345678919&project=/project/12345678920&fetch=true
Where 12345678919 and 12345678920 are the Workspace and Project OIDs, respectively.
Unfortunately Lookback API doesn't provide anything along the lines of tracking deletions or entries in the Recycle Bin. The focus is definitely on Analytics and providing a robust reporting engine for agile metrics.
This doesn't exclude the possibility that at some point LBAPI or other aspects of Rally services could be enhanced with trace-ability and tracking/accountability type of functionality. Enhanced trace-ability in Rally is something customers have expressed a need for and is definitely something that Rally's Product Management team is aware of as a customer need.