Lookback API: Is there a way to include more than one artifact type in a single query? - rally

In traditional Rally Webservices REST, if I wanted to get all Defects and Stories modified since a certain date, I would need to issue two separate REST GET requests against each of these endpoints:
https://rally1.rallydev.com/slm/webservice/1.33/hierarchicalrequirement
and
https://rally1.rallydev.com/slm/webservice/1.33/defect/
Is there a way to leverage the Lookback API to combine these into one REST request?

Sure, just add _Type:{$in:["Defect","HierarchicalRequirement"]} to the query. All of the work item types are stored in the same collection. You can also get back descendent Tasks and TestCases.

Related

Social Tables data model

I've just started looking at the documentation as we are going to need to integrate Salesforce with Social Tables shortly, so I am really new to Social Tables.
Specifically, we will need to sync data between the CRM and Social Tables Events and Guests, and maybe other objects, so it would be very helpful to have a data model or similar to check the relationships and fields available in Social Tables architecture.
I haven't found anything in the documentation, is there any way to get this, even if it's at a high level?
Thanks
Danny
To make an integration with SocialTables you'll have to do a few manual steps, there is no way to do this completely programmatic from my experience. You'll also have to be prepared to contact SocialTables to get get correct guestlist ids. Also keep in mind that the API documentation isn't always correct, the API logic is also quite difficult to understand from time to time.
The first thing you need to do is figure out which version of the Venue Mapper you use. You'd want to use the 4.0 api and as far as I know this version of the api is only supported by Venue Mapper 3.0. I believe the Venue Mapper 3.0 is the frontend tool SocialTables provides to do the venue planning.
In social tables an event has two ids, one numerical one and one alpha-numerical one, when you use the 4.0/events endpoint you only get the alpha-numerical event id, and your going to need the numerical one. The only way I've been able to get the numerical id is to pull it out from the url when using the Venue Mapper, example of the url follows below:
https://plan.socialtables.com/team/{team_id}/event/{event_id}/space/{space_id}
Now you need to get the guestlist id, you can get that by using the following url, using the numerical event id:
GET https://api.socialtables.com/4.0/diagrams?event={numerical_event_id}
This endpoint return a json structure where one of the parameters is "guestlist_id".
Please be aware that the guestlist id you get from this endpoint might not be the correct one. I struggled quite a bit with this part and ended up with SocialTables sending me the guestlist id by email.
To get the guests in your guestlist use the following api endpoint:
GET https://api.socialtables.com/4.0/guestlists/{guestlist_id}
The {guestlist_id} is an alpha-numerical string similar to: cfdac1c0-yb1d-12e6-84a5-a39e92131645
And by that you should hopefully get access to your guests.
Hey thanks for using our API.
To answer your question, the best way to see the data model at the moment is to access our developer portal and use the API console to see what is returned. For events you will need to know the team id of the team you are working with use the team events endpoint to get access to the event ids.
https://developer.socialtables.com/api-console#!/Events/get_4_0_legacyvm3_teams_team_events
This will return some basic information about each event for that team. You can then request additional details for specific events by using this endpoint:
https://developer.socialtables.com/api-console#!/Events/get_4_0_legacyvm3_events_event

Magento rest api resources

I have an android application connected to magento server by rest api. The application must preform some actions, but I have no examples of requests needed for the application.
For example I have this list of requests, but it is superficial enough for my application. For example, I do request:
"http://myUrl.com/api/rest/products?limit=15" and receive the list of 15 products. But after I need to receive next 15 product, and next, and next... What request can do it?
Also I need to do another requests which have no in site examples.
Where can I get more information and examples about rest api requests? Thank You in advance.
You can use various get filters available for REST request in magento GET FILTERS. To access second page you can use page filter available i.e. "http://myUrl.com/api/rest/products?limit=15&page=2". You can also combine many filters and use them as you want. Eg. For getting a result of products which have their name like 'product123', you can use: magentohost/api/rest/products?filter[1][attribute]=name&filter[1][like]=%product123%.

Flask REST api resource URLs suggestions

I'm working on REST Api suing Python Flask, as I have more and more routes, its hard to manage all the resource urls.
Right now, I'm confused which one is better practices of URL parameters. Examples below:
Get a list of courses with limits:
/courses/<int:lim> OR /courses/list?lim=10
Get a specific course:
/courses/<code>/<section> OR /courses/show?code=cs100&section=1
Get a list of students in specific course:
/courses/<code>/<section>/students OR /students/show?code=cs100&section=1
Should I pass query parameters using / or by doing ?
The only reason I'm using / is that there's no conflict in query.
If I have these two URL for two different queries, how can I fix it so I can query base on the parameters:
/students/show?code=cs100&section=1 (Get all students in that course)
/students/show?id=123456789 (Get the specific student)
The URL should identify a resource or collection of resources. Any options you want to give the client, such as pagination, limits, filtering, sorting, etc. I think is best to include in the query string or in HTTP headers.
So regarding your specific questions:
Get a list of courses with limits: /courses/<int:lim> OR /courses/list?lim=10
Neither one. Use /courses?lim=10. No need to have a /list component, that is an action, not a resource.
Get a specific course: /courses/<code>/<section> OR /courses/show?code=cs100&section=1
The first. Once again, /courses/show indicates an action, you want URLs to be links to resources, in this case your course.
Get a list of students in specific course: /courses/<code>/<section>/students OR /students/show?code=cs100&section=1
The first, same reason as the previous one.
I have given REST API talks at the last two PyCon conferences, feel free to check them out if you want to learn more API design best practices:
PyCon 2014: Writing RESTful Web Services with Flask
PyCon 2015: Is Your REST API RESTful?

Possible to fetch full hierarchical requirements in single portfolio item web service call?

I'm trying to aggregate some information about the kanban states of my user stories. If query a PifTeam item, I get a summarized collection of UserStories associated with it.
Example query:
https://rally1.rallydev.com/slm/webservice/1.40/portfolioitem/pifteam/99999999999.js
However I then have to run a loop on the UserStories collection, individually querying each one to get at the information I need. This potentially results in a lot of web service calls.
Is there a way to return the full hierarchical requirement information in the original pifteam query so that there is only one webservice call which returns all sub-objects? I read the webservice api and was trying to play with the fetch parameter but had no success.
This functionality will be disabled in WSAPI 2.0 but will continue to be available in the 1.x versions. That said, you should be able to use a fetch the fields on story that you need like this:
/pifteam/9999.js?fetch=UserStories,FormattedID,Name,PlanEstimate,KanbanState
Fetch will hydrate the fields specified on sub objects even if the root object type doesn't have those fields. So by fetching UserStories the returned collection will populated with stories, each having the FormattedID, Name, PlanEstimate and KanbanState fields included.
There is no way to do it from Rally's standard Web Services API (WSAPI) but you can from the new Lookback API (LBAPI). The query would look something like this:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/<ObjectID_for_Workspace>/artifact/snapshot/query.js?find={__At:"current",_TypeHierarchy:"HierarchicalRequirement",Children:null,_ItemHierarchy:<ObjectID_for_PortfolioItem>}&fields=["Name"]
Fill in the ObjectIDs for your Workspace and PortfolioItem. The _ItemHierarchy field will cross work item type boundaries and goes all the way from PortfolioItems down through the Story hierarchy down to Defects and even Tasks, so I added _TypeHierarchy:"HierarchicalRequirement" to limit it to Stories. I have specified Children:null which means you'll only get back leaf Stories. The __At:"current" clause get's the current tree and values. Remember, it's the "Lookback" API, so you can retrieve the state of the object at any moment in history. __At:"current" says to get the current values and tree.
Note, the LBAPI is delayed from current values in the system by anywhere from seconds to minutes. Typically it's about 30 seconds behind. You can see how far behind it is by checking the ETLDate field in the response.
Details about the LBAPI can be found here. Note, that the LBAPI is available in preview now for almost all Rally customers. There are still a number of customers where it is not yet turned on. The best way to tell if it's working for your subscription is to try the query.

Rally: Pull stories counts by schedule state for a release?

I'm trying to pull from the API of story counts for the latest release, broken down by schedule state. There's a report that does that currently, but I don't see any exposed method in the API. Does anyone know if that's possible to obtain?
You should be able to do a query for each schedule state, and grab TotalResultCount from the body of the response. For example:
https://rally1.rallydev.com/slm/webservice/1.31/hierarchicalrequirement.js?query=(ScheduleState = "Defined")
https://rally1.rallydev.com/slm/webservice/1.31/hierarchicalrequirement.js?query=(ScheduleState = "In-Progress")
and so on. Since there are only four "built-in" schedule states, plus an optional one before Defined and an optional one after Accepted, it's at most 6 requests.
You can further filter down Alan's examples above with some release information as well by changing the query parameter:
query=((ScheduleState = Defined) AND (Release.Name = "My Release"))
Are you writing an app using the App SDK or using one of our other REST toolkits (ruby, .net, python)? You may be able to find some better code examples here:
http://developer.rallydev.com
You might also try the Batch Query approach that allows you to just return the size of the query instead of counting the results. See the
"Getting the Size of a Collection" example of the api doc:
https://rally1.rallydev.com/slm/doc/webservice/batch.jsp#example8