Is there a way to find the workitems for a release in Azure DevOps Api 5.1? - azure-pipelines-release-pipeline

I can find a release in Azure DevOps Api 5.1 by a request to https://vsrm.dev.azure.com/mycompany/myproject/_apis/release/releases/myreleaseid?api-version=5.1
How can I get the workitems of that release as shown on the devops portal under Deployment - Stages - Workitems?
My naive approach just using https://vsrm.dev.azure.com/mycompany/myproject/_apis/release/releases/myreleaseid/workitems?api-version=5.1
resulted in a 404.
There is a stakeholder in the workitem and I want to send him a notification adter the release.

How can I get the workitems of that release as shown on the devops
portal under Deployment - Stages - Workitems?
Hard to say, but I don't find any document about this topic... So I determine to use F12 to find that. And here's the one I finally find:
Get:https://vsrm.dev.azure.com/mycompany/myproject/_apis/Release/releases/myreleaseId/workitems?baseReleaseId={my baseReleaseId}&%24top=250&artifactAlias={my artifactAlias}
It will returns the IDs of the workItems for the release. Its response format:
After you get the IDs, it's easy to get details if you need using Get Work Items Batch or what.
In addition:
1.myreleaseId is the ReleaseID. (On my side, the ID is 7 if it's Release-7)
2.my artifactAlias is this:
3.For my baseReleaseId, I'm not 100% sure about its meaning. I think it could be something like ReleaseToCompareAgainst. Hint from Daniel. (On my side, if my releaseId=7, then I use basereleaseID=6(7-1), it works to get the correct WIT ids). (Actually I suggest you can use F12 in that web page to check your corresponding URL.)
And according to Mathias F: The baseReleaseId realy is the last previous release that has a deployment (-1 in some cases)
4.About how to use F12 to find rest api which may not be documented:
Hope all above helps :)

Related

What is the reason why the OneNote APIs won't return all the pages in a notebook?

I am reading around here and I am seeing multiple messages about the /pages endpoint that is not working a expected
It seems that the OneNote APIs (MS Graph or Office365) are not returning all the pages that the user can see. In particular recent pages are not shown as available.
This message is for those of you who work for Microsoft and who keep an eye on this forum. Please if you have any explanation or workaround for this we would like to hear about it.
If this is work in progress we would also like to know when the APIs can be considered stable and reliable enough to consider them OK for production use
Update:
Permissions or scopes
scopes=[
"Notes.Read",
"Notes.Read.All",
"Notes.ReadWrite",
]
This is for a device authorization flow, the device is acting as a Microsoft Online account. The app is registered to Azure as personal app but the enterprise one does the same
The authorization process is described here
What type of app/authentication flow should I select to read my cloud OneNote content using a Python script and a personal Microsoft account?
After that I am using this endpoint to get the notebooks
https://graph.microsoft.com/v1.0/users/user-id/onenote/notebooks
from the returned json I pick the endpoint for the notebook I want to read and I access the endpoint the link stored in notebook['sectionsUrl']. This call returns a sections json
From this I pick the section I want and I access the link stored in section['pagesUrl']
Each call returns the expected info excepting the last one, when I get an arbitrary low number of pages in the section I want to explore. There is nothing wrong with the format of the info, it is just incomplete or not up to date
Not sure if this is related but when I try to access the pages in a section from MS Graph Explored I am seeing the same behavior (not all the pages are reported). This is a shared notebook and I am using the owner account for all the above so it should not be a permission problem
from msal import PublicClientApplication
import requests
endpoint= "https://graph.microsoft.com/v1.0/me/onenote"
authority = "https://login.microsoftonline.com/consumers"
app=PublicClientApplication(client_id=client_id, authority=authority)
flow = app.initiate_device_flow(scopes=scopes)
# there is an interactive part here that I automated using selenium, you
# are supposed to ouse a link to enter a code and then autorize the
# device; code not shown
result = app.acquire_token_by_device_flow(flow)
token= result['access_token']
headers={'Authorization': 'Bearer ' + token}
endpoint= "https://graph.microsoft.com/v1.0/users/c5af8759-4785-4abf-9434-xxxxxxxxx/onenote/notebooks"
notebooks = requests.get(endpoint,headers=headers).json()
for notebook in notebooks['value']:
print(notebook['displayName'])
print(notebook['sectionsUrl'])
print(notebook['sectionGroupsUrl'])
# I pick a certain notebook
section=[section for section in sections if section['displayName']=="Test"][0]
endpoint=notebook['sectionsUrl']
pages=requests.get(endpoint,headers=headers).json()
for page in pages['value']:
print(page['title'])
Update2
If I use this endpoint
https://graph.microsoft.com/v1.0/users/user-id/onenote/sections/section-id/pages
I would expect to get the complete list of pages for that section.
That is not working
After reading again and again the docs I my understanding is that the approach is to
call https://graph.microsoft.com/v1.0/users/user-id/onenote/pages$fiter or search etc etc
I this correct?
Also I vaguely remember there is a way to search for a section and have it expanded so that the search returs the children too.
Am I close to understanding this?
Thank you
MM

Where can I see Asterisk REST recordings listing?

I have recently installed FreeBPX with asterisk included. I activated the rest interface, so I can see /ari/asterisk/info and it responds with a JSON. Now I want to see all my call recordings. I configured recordings and the server saves them in wav format. It's ok, but how can I see them through json/rest? I tried open /ari/asterisk/recordings, but it responds with "resource not found".
As yo can see in the docs, you can use:
GET /recordings/stored/{recordingName}
EDIT: You can see the list of recordings stored with
GET /recording/stored
You are missing the point here, the ARI recordings interface isn't meant to be used with the files that you have stored via FreePBX. The recordings API is meant to allow you to manage recordings, from within a Stasis application. That means, start a recording from a Stasis application and manage it. If the recording had been performed outside of Stasis, the ARI engine will not be aware of it.
Well, at least that's what it's supposed to do.
Nir
This is partly doable - FreePBX doesn't seem to use the native Asterisk recording APIs so you can only retrieve the filename
First get all the channels:
GET /ari/channels
Find your channel's ID from the response's id field
Then you can request the variable CALLFILENAME from the channel's variable endpoint:
GET /ari/channels/{id}/variable?variable=CALLFILENAME

The prefix "atom" for element "atom:cc" is not bound exception

I am trying to fetch the contacts of the user who have an account in google apps marketplace. While fetching the contact i get the following error
com.google.gdata.util.ParseException: The prefix "atom" for element "atom:cc" is not bound.
at com.google.gdata.util.XmlParser.parse(XmlParser.java:695)|
at com.google.gdata.util.XmlParser.parse(XmlParser.java:568)|
at com.google.gdata.data.BaseFeed.parseAtom(BaseFeed.java:793)|
at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:68)|
at com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:39)|
at com.google.gdata.wireformats.input.CharacterParser.parse(CharacterParser.java:)|
at com.google.gdata.wireformats.input.XmlInputParser.parse(XmlInputParser.java:52)|...
I am using Java client library to fetch the contacts. Can you please let me know is there an issue in the java client library? This issue is there for a long time and I badly need to find a solution for this...What should I do to make it work...Any help will be grateful..
Thanks,
VijayRaj
I got the same Problem, that you have with the Java Client, with the .NET client.
After contacting Google support, they told me that the Contacts arbitrary XML data which is in an Property element cannot be parsed within my version of GData .
However, there is a time intensive workaround, by deleting and recreating Contacts, but thats probably not what you are looking for, me either.
After switching to the Python implementation all works fine now.
Check out this Issue report Issue 361

RTC client: get current work item?

I'm looking for a way to extend the RTC client to get the current work item programmatically, or even better add a listener that notifies me whenever the current work item is changed.
I don't know where to start. Any hints?
One can use the following code to get the IWorkItemActivationManager:
IWorkItemActivationManager manager = ClientModel.getWorkItemActivationManager();
Wie this manager, it is possible to use the method getActiveWorkItem to get a IWorkItemHandle:
IWorkItemHandle handle = manager.getActiveWorkItem();
Then the following code can be used to get the IWorkItem:
IAuditableClient auditableClient= (IAuditableClient) Controller.getInstance().getTeamRepository().getClientLibrary(IAuditableClient.class);
IWorkItem item = auditableClient.resolveAuditable(handle, com.ibm.team.workitem.common.model.IWorkItem.FULL_PROFILE, null);
The ClientModel is in the following package: com.ibm.team.workitem.rcp.core
One way I usually explore is the OSLC API through REST call.
With a Chrome and its "Developer Tool" activated, I click on the web client and look at the request done.
That gives an indication of the kind of service involved.
Then you can look at "How to consume the Rational Team Concert change management services", which illustrates how those services are structured.
Combine it with "Extending Rational Team Concert 3.x" and you can start from there.

Determine if given job is currently running using Hudson/Jenkins API

Is there an API to determine whether a given job is currently running or not?
Ideally, I'd also like to be able to determine its estimated % complete and get the details of the SVN revision number and commit comment too!
EDIT:
I found the answer. http://host/job/project/lastBuild/api/ has almost all of what I need in it somewhere! If you kick off a manual build, it won't tell you the SCM changesets, but that makes sense. It does still tell you the latest SCM revision though, so that's good. All in all, good enough for my purposes right now.
As gareth_bowles and Sagar said, using the Jenkins API is the way to know.
If you put the depth to 1, you will see what you're looking for:
http://host/job/project/lastBuild/api/xml?depth=1
You will see there's a <building> tag to tell if that build is running
...
<build>
<action>
<cause>
<shortDescription>Started by user Zageyiff</shortDescription>
<userId>Zageyiff</userId>
<userName>Zageyiff</userName>
</cause>
</action>
<building>true</building>
<duration>0</duration>
<estimatedDuration>-1</estimatedDuration>
<fullDisplayName>Project #12</fullDisplayName>
<id>2012-08-24_08-58-45</id>
<keepLog>false</keepLog>
<number>12</number>
<timestamp>123456789</timestamp>
<url>
http://host/job/project/12
</url>
<builtOn>master</builtOn>
<changeSet/>
<mavenVersionUsed>3.0.3</mavenVersionUsed>
</build>
...
I'm using the Groovy plug-in, and run the following snippet as system:
import hudson.model.*
def version = build.buildVariableResolver.resolve("VERSION")
println "VERSION=$version"
def nextJobName = 'MY_NEXT_JOB'
def nextJob = Hudson.instance.getItem(nextJobName)
def running = nextJob.lastBuild.building
if (running) {
println "${nextJobName} is already running. Not launching"
} else {
println "${nextJobName} is not running. Launching..."
def params = [
new StringParameterValue('VERSION', version)
]
nextJob.scheduleBuild2(0, new Cause.UpstreamCause(build), new ParametersAction(params))
}
It works like a charm.
If you go to your job's page, and add "api" to the end of the URL, you'll get information on using the API.
http://yourjenkins/job/job_name/api
More information on using the Jenkins API:
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
If you're comfortable with digging through the Jenkins Java API, you could write a system Groovy script to get this data. The Job class is the place to start.
As stated on the /api page of your build (chapter "Accessing Progressive Console Output"), you can poll the console output with a GET request by calling <url-to-job>/lastBuild/logText/progressiveText. To quote the API doc:
If the response also contains the X-More-Data: true header, the server is indicating that the build is in progress
And there you go. You can test this behaviour by simply calling the respective URL in your browser and then inspecting the response headers with your browser's developer tools (usually accessed by pressing F12). In Firefox, the respective tab is called "network analysis" (assuming my translation is correct, my browser is not set to English). In Chrome, navigate to the "Network" tab.
This answer is based on Jenkins version 2.176.3.
It is also possible to look at the color attribute. I know it is not the wanted way. But maybe someone can make use of it.
get the overview xml via "/job/api/xml" and then check the color attribute for "anim".