How to get code coverage percentage for latest build from TFS 2017u2 using PowerShell & REST API - rest

Using PowerShell, how can I query Team Foundation Server 2017 Update 2 (on-premises) to get the code coverage percentage metric from the latest completed gated check-in?
I've not found a clear API call to use in the MS reference documentation. In the web interface, I can see in the dashboard for a given completed build the percentage value and a link to download the entire Visual Studio coverage file. I don't want the file, though. I just want to make an API call and get the percent coverage value for the last successful build of a given definition.

Unfortunately, the docs for VSTS's REST API are down right now, but this should get you started (pulled from Google's Cache).
This endpoint handles everything related to Tests and Code Coverage.
https://{instance}/DefaultCollection/{project}/_apis/test/codeCoverage?api-version={version}[&buildId={int}&flags={int}]
Provide values for the following and then run this Invoke-RestMethod to get the data back.
$Instance = 'fabrikam-fiber-inc.visualstudio.com' #your URL here
$ProjectName = #YourProjectNameHere
$buildID = #YourBuildIDHere
$version = '2.0-preview'
Invoke-RestMethod -uri https://$Instance/DefaultCollection/$ProjectName/_apis/test/codeCoverage?api-version=$version
Here's a sample response you can get back:
Status code: 200
{
"value": [
{
"configuration": {
"id": 51,
"flavor": "Debug",
"platform": "Any CPU",
"uri": "vstfs:///Build/Build/363",
"project": {}
},
"state": "0",
"lastError": "",
"modules": [
{
"blockCount": 2,
"blockData": "Aw==",
"name": "fabrikamunittests.dll",
"signature": "c27c5315-b4ec-3748-9751-2a20280c37d5",
"signatureAge": 1,
"statistics": {
"blocksCovered": 2,
"linesCovered": 4
},
"functions": []
}
],
"codeCoverageFileUrl": "..."
}
],
"count": 1
}
It looks like blocksCovered and livesCovered are probably the closest you'll get from the API. Let me know if you need some help or get stuck. Eventually, the docs will be back online at this URL.

Related

MashupValueException when creating a Web Table Linked Service on ADF?

I'm experiencing a MashupValueException while creating a Web Table Linked Service and I wonder if someone here have come across the same issue.
The config of the Linked Service is as follows:
{
"name": "WikipediaLS",
"properties": {
"annotations": [],
"type": "Web",
"typeProperties": {
"url": "https://www.the-numbers.com/",
"authenticationType": "Anonymous"
},
"connectVia": {
"referenceName": "MySelfHostedIR",
"type": "IntegrationRuntimeReference"
}
}
}
The error happens after filling the info on the form and clicking on "Test Connection". Then the following error pops up:
Connection failed
'Type=Microsoft.Data.Mashup.MashupValueException,Message=The supplied URL must be a valid 'http:' or 'https:' URL.,Source=Microsoft.Data.Mashup.ProviderCommon,' Activity ID: c8d924b9-cc81-49c1-85c8-70abfa85c859.
I have tested the extraction of the web table using Office 2016 and it works all right.
The aim is to extract the index 0 table from "https://www.the-numbers.com/movie/budgets/all".
This is what you are facing:
You can try to use below url, it can connect to the web successfully on my side:
https://www.the-numbers.com/movie/budgets/all
The website you give seems not stable. Sometimes you cannot visit the database.

"The agent returned an empty TTS" when action is not opened separately to asking an intent

When I invoke the skill with 'okay Google, ask {skillname} to {utterance}' I get the response 'The agent returned an empty tts" and the conversation closes. It doesn't even seem to hit my backend - I've tried hosting the backend code on both a local server and on AWS and the same issue happens in both cases. There's no log of the request being made either on Stackdriver on Google or on CloudWatch on AWS. The only response I get is the following in the debug tab:
{
"response": "The agent returned an empty TTS.",
"expectUserResponse": false,
"conversationToken": "EosDS2o4d0...",
"audioResponse": "",
"ssmlMarkList": [],
"debugInfo": {
"sharedDebugInfoList": [
{
"name": "Response Validation",
"debugInfo": "The agent returned an empty TTS.",
"subDebugEntryList": []
}
],
"conversationBuilderExecutionEventsList": []
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "The agent returned an empty TTS."
}
}
],
"suggestionsList": [],
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": true,
"clientOperationList": [],
"projectName": "",
"renderedHtml": ""
}
Nothing in any of the other tabs. When I try invoking the phrases in the same way on my phone, I just see a loading symbol and again nothing in the logs to say it's even hitting the backend.
Weirdly, this doesn't happen when I say 'okay Google, talk to {skillname} {utterance}' - this works absolutely fine.
All the intents work perfectly well when I've opened my action first, and then invoke them. I've built this using Jovo and published on Alexa also and the problem is only happening on Google.

is there a way to put web-activity result into sql-table (sink)

Unable to get the output of a web activity into a sql-table using azure-data-factory.
This is what i have done and where im getting stuck (Step 3).
Steps:
1.Get a token from a API-call
Get the results from API Call using token from step 1
and tkae this results in a successfull query that provides me with 'JSON'
Take the result from previous activity 'JSON' and put in in a azure sql database table.
azure-datafactory - web activites
Can you not get this done using a copy activity ? You should configure the source as Web activity and sink as SQL. I was playing with this http://dummy.restapiexample.com/api/v1/employees and we needed to introduce the structure . This is what I did and it work .
"source": {
"type": "RestSource",
"httpRequestTimeout": "00:01:40",
"requestInterval": "00.00:00:00.010",
"structure": [
{
"id": "id"
},
{
"employee_salary": "employee_salary"
}
]
},
"sink": {
"type": "SqlServerSink",
"writeBatchSize": 10000
},
"enableStaging": false
},
You can read more . https://learn.microsoft.com/en-us/azure/data-factory/copy-activity-schema-and-type-mapping

calling UCWA with c# - lync 2013 server

I sent a get request to below url (I replaced my company's real domain name with xxx here)
http://lyncdiscover.xxx.com/?sipuri=abc#xxx.com
instead of getting this format according to many blog.
{
"_links":{
"self":{
"href":"https://lyncweb.sipdomain.co.uk/Autodiscover/AutodiscoverService.svc/root?originalDomain=sipdomain.co.uk"
},
"user":{
"href":"https://lyncweb.sipdomain.co.uk/Autodiscover/AutodiscoverService.svc/root/oauth/user?originalDomain=sipdomain.co.uk"
},
"xframe":{
"href":"https://lyncweb.sipdomain.co.uk/Autodiscover/XFrame/XFrame.html"
}
}
}
I got this format returned back without xframe (I replaced the domain with xxx):
{
"AccessLocation": "External",
"Root": {
"Links": [
{
"href": "https://lswebservice.xxx.com/Autodiscover/AutodiscoverService.svc/root/domain",
"token": "Domain"
},
{
"href": "https://lswebservice.xxx.com/Autodiscover/AutodiscoverService.svc/root/user",
"token": "User"
}
]
}
}
what do I miss here?
You will want to update your Lync Server 2013 environment - Updates for Lync Server 2013. UCWA went live with Lync Server 2013 (CU1) and what you initially hit is the Autodiscovery service which was updated in CU1 to return the format you are expecting above.
The information was contained on the last paragraph on ITAdmin-Configuration documentation.

Facebook API: How to get count of group members

Im working on fb app using PHP client and FQL.Looks like that fb api doesnt support this. You can get max random 500 members with FQL. But when group has more than 500 members there is no way how to get total count of members.
I need only number dont care about member details.
Anyone can help me please?
I have actually found that you cannot, it is by design apparently. I wanted to know this myself about a month ago, and found that no matter what parameters you pass in to the graph api, you can not get past the 500th member. Even if you tell it to start at number 450 and give you 200, it will give you only 450-500.
Here's me asking, and the unfortunate answer:
http://forum.developers.facebook.net/viewtopic.php?id=82134
you can use graph api 2.0 and sdk 4.0
you can use below code
$url1= "https://graph.facebook.com/".$gid."/members?limit=10000&access_token=".$_SESSION['fb_token'];
if(!extension_loaded('curl') && !#dl('curl_php5.so'))
{
return "";
}
$parsedUrl = parse_url($url1);
$ch = curl_init();
$options = array(
CURLOPT_URL => $url1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTPHEADER => array("Host: " . $parsedUrl['host']),
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => false
);
curl_setopt_array($ch, $options);
$response_count = #curl_exec($ch);
$json_count = json_decode($response_count);
foreach ($json_count as $item_count)
{
$cnt=count($item_count);
break;
}
You can use the summary parameter which will return a total_count value.
/v2.11/{GROUP_ID}?fields=members.limit(0).summary(true)
It also works when searching for groups:
/v2.11/search?q=stackoverflow&type=group&fields=id,name,members.limit(0).summary(true)
{
"data": [
{
"id": "667082816766625",
"name": "Web Development Insiders",
"members": {
"data": [
],
"summary": {
"total_count": 2087
}
}
},
{
"id": "319262381492750",
"name": "WEB Developers India",
"members": {
"data": [
],
"summary": {
"total_count": 10240
}
}
}...
]
}
Make a query to:
https://graph.facebook.com/v2.11/{group-id}/members?limit=1500&access_token={token}
(replace {group-id} by the numeric group identification and {token} by your access token).
You will get a response like this:
{
"data": [
{
"name": "Foo bar",
"id": "123456",
"administrator": false
},
...
],
"paging": {
"cursors": {
"before": "QVFIUkwzT3FKY0JSS2hENU1NUlZAocm9GelJMcUE3S1cxWWZAPYWx1cUQxcXFHQUNGLUJnWnZAHa0tIdmpMT0U5ZAjRBLUY5Q2ZAGbmwwVTNoSHhLc1BCc2dvVTF3",
"after": "QVFIUkFoU3lYR2tXc09adkg5OGhlbHRWRk1GYkZAzQU1DalRSY05zOVl5aE1tcjRMS3lXLURaVWNMOGZArWTVxS2hPQUVGVWxhbXZAyZA0p3azVKM2hBSEp3YlpR"
}
},
"next": "https://graph.facebook.com/v2.11/123928391023981/members?access_token=EAACEdEose0cBALBDrdgLyVOjzW4mz6G3d3Yj1fTGYqygVgYq0JCDZAi0zYsY90pSSQ9hQZCn3TdwfXIAiyoXH5oUYcA4hOcCI9jztkkUhbBv9tEQ3ZBEEuHpmkm3kmgvk1HNq5mo6BM0hz8XkOLVh3twIdz83KhB9SkqxuxHeFD9GWsQqjys6XTuL2315QZD&pretty=0&limit= 1500&after=QVFIUkFoU3lYR2tXc08adkg5OGhlbHRWYk1GYkZAzQU1DalRSY05zOVl5aQ1tcjRMS3lXLURaVWNMOGZArWTVxS2hPQUVGVWxhbXZAyZA0p3azVKM1hBSEp3YlpR"
}
Then follow this algorithm:
Make a count variable with a 0 value.
Count the objects in the data array of the latest response and add the count to the count variable.
If the latest response has the next property, make a request to the URL which is the next property value and return to the step 2. Otherwise you have finished, the count of members is the count variable value.
This way is not very good because the more members there are in the group the more queries are required. I would be better to parse the number of members from the group page HTML but I can't find reliable way to do it.
Update 2017.10.19: If the Facebook API response size is more then about 345KB, Facebook returns an error: Please reduce the amount of data you're asking for, then retry your request. It is about 1997 members. So you need to set the limit request parameter to 1500 not to face the error.
Update 2018.01.26: There is a way to get a count of members using a single request: https://stackoverflow.com/a/47783306/1118709
Update 2018.01.31: After 90 days from releasing Graph API v2.12 the request will require an access token of an admin of the group. Source: Graph API docs / v2.12 changelog / 90-day breaking changes
You should do it with an FQL query on the group_member table like:
SELECT uid FROM group_member WHERE gid = <group_id> limit 500 offset 500
Example here: Is it possible / how to get number of a particular Facebook Group members (even if number of them is 500+)?