Send email report after test execution in Azure pipelin - c#

I have implemented C# selenium automation script with Azure pipeline. I wanted to send the execution test result to my email id. Is there any way we can achieve this?

For now , you can only write a custom extension to send an email with the test result which you can call it from your Azure devops pipeline.
But you can use below set of API for getting the test result.
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=5.0
with optional parameter.
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?detailsToInclude={detailsToInclude}&$skip={$skip}&$top={$top}&outcomes={outcomes}&api-version=5.0
where params are :
here is the sample response:
{
"count": 3,
"value": [
{
"id": 100000,
"project": {
"id": "5c3d39df-a0cb-49da-be01-42e53792c0e1",
"name": "Fabrikam-Fiber-TFVC",
"url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
},
"startedDate": "2016-07-13T11:12:48.487Z",
"completedDate": "2016-07-13T11:12:48.493Z",
"durationInMs": 4,
"outcome": "Passed",
"revision": 1,
"runBy": {
"id": "a5cbf24d-799f-452e-82be-f049a85b5895",
"displayName": "Fabrikam",
"uniqueName": "fabrikamfiber.vsin#hotmail.com",
"url": "https://dev.azure.com/fabrikam/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
},
"state": "Completed",
"testCase": {
"name": "Pass1"
},
"testRun": {
"id": "16",
"name": "VSTest Test Run release any cpu",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16"
},
"lastUpdatedDate": "2016-07-13T11:12:49.123Z",
"lastUpdatedBy": {
"id": "375baa5b-5148-4e89-a549-ec202b722d89",
"displayName": "Project Collection Build Service (fabrikam)",
"uniqueName": "Build\\78b5727d-4a24-4ec8-9caf-704685572174",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/375baa5b-5148-4e89-a549-ec202b722d89",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=375baa5b-5148-4e89-a549-ec202b722d89"
},
"priority": 0,
"computerName": "TASKAGENT5-0055",
"build": {
"id": "5",
"name": "20160713.2",
"url": "https://dev.azure.com/fabrikam/_apis/build/Builds/5"
},
"createdDate": "2016-07-13T11:12:49.123Z",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/Results/100000",
"failureType": "None",
"automatedTestStorage": "unittestproject1.dll",
"automatedTestType": "UnitTest",
"automatedTestTypeId": "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b",
"automatedTestId": "aefba017-ab06-be36-6b92-de4e29836f72",
"area": {
"id": "37528",
"name": "Fabrikam-Fiber-TFVC",
"url": "vstfs:///Classification/Node/ebe8ac79-8d9f-4a5b-8d0a-c3095c81e70e"
},
"testCaseTitle": "Pass1",
"customFields": [],
"automatedTestName": "UnitTestProject1.UnitTest1.Pass1"
},
{
"id": 100001,
"project": {
"id": "5c3d39df-a0cb-49da-be01-42e53792c0e1",
"name": "Fabrikam-Fiber-TFVC",
"url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
},
"startedDate": "2016-07-13T11:12:48.547Z",
"completedDate": "2016-07-13T11:12:48.62Z",
"durationInMs": 74,
"outcome": "Failed",
"revision": 1,
"runBy": {
"id": "a5cbf24d-799f-452e-82be-f049a85b5895",
"displayName": "Fabrikam-Fiber-TFVC",
"uniqueName": "fabrikamfiber.vsin#hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
},
"state": "Completed",
"testCase": {
"name": "Fail1"
},
"testRun": {
"id": "16",
"name": "VSTest Test Run release any cpu",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16"
},
"lastUpdatedDate": "2016-07-13T11:12:49.123Z",
"lastUpdatedBy": {
"id": "375baa5b-5148-4e89-a549-ec202b722d89",
"displayName": "Project Collection Build Service (fabrikam)",
"uniqueName": "Build\\78b5727d-4a24-4ec8-9caf-704685572174",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/375baa5b-5148-4e89-a549-ec202b722d89",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=375baa5b-5148-4e89-a549-ec202b722d89"
},
"priority": 10,
"computerName": "TASKAGENT5-0055",
"build": {
"id": "5",
"name": "20160713.2",
"url": "https://dev.azure.com/fabrikam/_apis/build/Builds/5"
},
"errorMessage": "Assert.Fail failed. ",
"createdDate": "2016-07-13T11:12:49.123Z",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/Results/100001",
"failureType": "None",
"automatedTestStorage": "unittestproject1.dll",
"automatedTestType": "UnitTest",
"automatedTestTypeId": "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b",
"automatedTestId": "7c66fbda-2d0e-a714-e18d-83c0464019a5",
"area": {
"id": "37528",
"name": "Fabrikam-Fiber-TFVC",
"url": "vstfs:///Classification/Node/ebe8ac79-8d9f-4a5b-8d0a-c3095c81e70e"
},
"testCaseTitle": "Fail1",
"stackTrace": " at UnitTestProject1.UnitTest1.Fail1() in C:\\a\\1\\s\\UnitTestProject1\\UnitTestProject1\\UnitTest1.cs:line 20\r\n",
"customFields": [],
"failingSince": {
"date": "2016-07-13T11:11:17.587Z",
"build": {
"id": 4,
"definitionId": 0,
"number": "20160713.1",
"buildSystem": "Azure DevOps Services"
}
},
"automatedTestName": "UnitTestProject1.UnitTest1.Fail1"
},
{
"id": 100002,
"project": {
"id": "5c3d39df-a0cb-49da-be01-42e53792c0e1",
"name": "Fabrikam-Fiber-TFVC",
"url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
},
"startedDate": "2016-07-13T11:12:48.623Z",
"completedDate": "2016-07-13T11:12:48.623Z",
"outcome": "NotExecuted",
"revision": 1,
"runBy": {
"id": "a5cbf24d-799f-452e-82be-f049a85b5895",
"displayName": "Fabrikam-Fiber-TFVC",
"uniqueName": "fabrikamfiber.vsin#hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
},
"state": "Completed",
"testCase": {
"name": "Ignore1"
},
"testRun": {
"id": "16",
"name": "VSTest Test Run release any cpu",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16"
},
"lastUpdatedDate": "2016-07-13T11:12:49.123Z",
"lastUpdatedBy": {
"id": "375baa5b-5148-4e89-a549-ec202b722d89",
"displayName": "Project Collection Build Service (fabrikam)",
"uniqueName": "Build\\78b5727d-4a24-4ec8-9caf-704685572174",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/375baa5b-5148-4e89-a549-ec202b722d89",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=375baa5b-5148-4e89-a549-ec202b722d89"
},
"priority": 20,
"computerName": "TASKAGENT5-0055",
"build": {
"id": "5",
"name": "20160713.2",
"url": "https://dev.azure.com/fabrikam/_apis/build/Builds/5"
},
"createdDate": "2016-07-13T11:12:49.123Z",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/Results/100002",
"failureType": "None",
"automatedTestStorage": "unittestproject1.dll",
"automatedTestType": "UnitTest",
"automatedTestTypeId": "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b",
"automatedTestId": "ef9123e0-a097-7e9b-9a02-f526c7a640c0",
"area": {
"id": "37528",
"name": "Fabrikam-Fiber-TFVC",
"url": "vstfs:///Classification/Node/ebe8ac79-8d9f-4a5b-8d0a-c3095c81e70e"
},
"testCaseTitle": "Ignore1",
"customFields": [],
"automatedTestName": "UnitTestProject1.UnitTest1.Ignore1"
}
]
}
You can write a custom utility in which you can write a function to get the test result and publish it using email and then later on you can call it from Azure devops pipeline task.
Here you can find the sample doc for custom defined task.
Hope it helps.

Related

Trying to setup diagnostic settings for activity logs in ARM template

I've been trying to create a template for a logger function app in Azure, the basic idea is that it'll forward all activity log category info along with all audit log info using event hubs as triggers, I've gotten down most of the template, but I keep hitting the following error when it comes to the diagnostic settings part:
The resource type '/' does not support diagnostic settings.
Is there something I'm doing wrong? I've only started working with azure for a short while, and am afraid I'm misunderstanding how diagnostic settings are created in an ARM template. I can't seem to find any template or documentation online about this, and am at a loss...
Here's an excerpt:
...
"variables": {
"eventHubNamespaceName": "azure-logger",
"auditEventHubName": "[concat(variables('eventHubNamespaceName'), '/', 'audit-logs')]",
"activityEventHubName": "[concat(variables('eventHubNamespaceName'), '/', 'activity-logs')]",
"authRuleResourceId": "[resourceId('Microsoft.Eventhub/namespaces/authorizationRules', variables('eventHubNamespaceName'), 'RootManageSharedAccessKey')]",
"auditAuthorizationRuleId": "[resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('eventHubNamespaceName') , 'audit-logs', 'default')]",
"activityAuthorizationRuleId": "[resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('eventHubNamespaceName') , 'activity-logs', 'default')]"
},
"resources": [
{
"name": "[variables('eventHubNamespaceName')]",
"type": "Microsoft.EventHub/namespaces",
"apiVersion": "2021-06-01-preview",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"status": "Active"
},
"resources": [
{
"type": "Microsoft.EventHub/namespaces/eventhubs",
"apiVersion": "2021-06-01-preview",
"name": "[concat(variables('eventHubNamespaceName'), '/', 'audit-logs')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]"
],
"properties": {
"messageRetentionInDays": 1,
"partitionCount": 1
},
"resources": [
{
"type": "Microsoft.EventHub/namespaces/eventhubs/authorizationRules",
"apiVersion": "2021-06-01-preview",
"name": "[concat(variables('eventHubNamespaceName'), '/', 'audit-logs','/','default')]",
"properties": {
"rights": [ "Manage", "Listen", "Send" ]
},
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('eventHubNamespaceName'), 'audit-logs')]"
]
}
]
},
{
"type": "Microsoft.EventHub/namespaces/eventhubs",
"apiVersion": "2021-06-01-preview",
"name": "[concat(variables('eventHubNamespaceName'), '/', 'activity-logs')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]"
],
"properties": {
"messageRetentionInDays": 1,
"partitionCount": 1
},
"resources": [
{
"type": "Microsoft.EventHub/namespaces/eventhubs/authorizationRules",
"apiVersion": "2021-06-01-preview",
"name": "[concat(variables('eventHubNamespaceName'), '/', 'activity-logs','/','default')]",
"properties": {
"rights": [ "Manage", "Listen", "Send" ]
},
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('eventHubNamespaceName'), 'activity-logs')]"
]
}
]
}
]
},
{
"type": "Microsoft.Insights/diagnosticSettings",
"apiVersion": "2017-05-01-preview",
"name": "[concat(variables('eventHubNamespaceName'),'activity-logs')]",
"properties": {
"eventHubName": "activity-logs",
"eventHubAuthorizationRuleId": "[variables('activityAuthorizationRuleId')]",
"logs": [
{
"category": "Administrative",
"enabled": true
},
{
"category": "Security",
"enabled": true
},
{
"category": "ServiceHealth",
"enabled": true
},
{
"category": "Alert",
"enabled": true
},
{
"category": "Recommendation",
"enabled": true
},
{
"category": "Policy",
"enabled": true
},
{
"category": "Autoscale",
"enabled": true
},
{
"category": "ResourceHealth",
"enabled": true
}
]
}
}
]
...```
Diagnostic settings for Activity logs are created for a subscription, not for a resource group like settings for Azure resources. Therefore, when you check the Diagnostic setting for Activity log in this document, you will find that you can deploy Azure Resource Manager templates using any valid method including PowerShell and CLI. Diagnostic settings for Activity log must deploy to a subscription using az deployment create for CLI or New-AzDeployment for PowerShell.
And the template should look like as following :
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"settingName": {
"type": "String"
},
"workspaceId": {
"type": "String"
},
"storageAccountId": {
"type": "String"
},
"eventHubAuthorizationRuleId": {
"type": "String"
},
"eventHubName": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Insights/diagnosticSettings",
"apiVersion": "2017-05-01-preview",
"name": "[parameters('settingName')]",
"properties": {
"workspaceId": "[parameters('workspaceId')]",
"storageAccountId": "[parameters('storageAccountId')]",
"eventHubAuthorizationRuleId": "[parameters('eventHubAuthorizationRuleId')]",
"eventHubName": "[parameters('eventHubName')]",
"logs": [
{
"category": "Administrative",
"enabled": true
},
{
"category": "Security",
"enabled": true
},
{
"category": "ServiceHealth",
"enabled": true
},
{
"category": "Alert",
"enabled": true
},
{
"category": "Recommendation",
"enabled": true
},
{
"category": "Policy",
"enabled": true
},
{
"category": "Autoscale",
"enabled": true
},
{
"category": "ResourceHealth",
"enabled": true
}
]
}
}
]
}
You should have a Parameter file if you follow the above template.
Also note that when virtual networks are enabled Diagnostic Settings can't access Event Hubs resources. You have to enable the Allow trusted Microsoft services to bypass this firewall setting in Event Hub, so that Diagnostic Settings (Azure Monitor Services) is granted access to your Event Hubs resources.

Message card rendering issue in bot framework v3

I have a message card payload pushed from service now which is not rendering properly on MS Teams through bot framework. It only displays the content but not the button.Below is the payload, pls suggest what could be the issue.
BotFramework:V3
.Net SDK
Bot Builder package:3.12.2.4
Bot Connector:3.12.2.4
Bot.Connector.Teams:0.9.0
{
"contentType": "application/vnd.microsoft.teams.card.o365connector",
"content": {
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"title": "Incident Updated - INC0010010",
"summary": "Incident Updated - INC0010010",
"themeColor": "D1222B",
"sections": [
{
"title": "",
"text": "",
"activityTitle": "",
"activitySubtitle": "",
"activityText": "",
"facts": [
{
"name": "Category",
"value": "Software"
},
{
"name": "State",
"value": "New"
},
{
"name": "Priority",
"value": "5 - Planning"
},
{
"name": "Assignment group",
"value": "Software"
}
]
},
{
"text": "Please check the details"
}
],
"potentialAction": [
{
"#type": "OpenUri",
"name": "View Incident in ServiceNow",
"targets": [
{
"os": "default",
"uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"
},
{
"os": "iOS",
"uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"
},
{
"os": "android",
"uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"
},
{
"os": "windows",
"uri": "https://dev62584.service-now.com/incident.do?sys_id=7ec9865adb711010fcff8809489619b4&sysparm_stack=incident_list.do?sysparm_query=active=true"
}
]
}
]
}
}
Microsoft Troubleshooting and recommendation:
We were finally able to repro this issue. It is a bug in the team's scope and doesn't repro in the personal scope. An easy way to unblock you would be to add in the potentialAction section an #id field like so:
"potentialAction": [
{
"#id":"1",
"#type": "OpenUri",
Nothing stands out as a bug in your code or problem with your configuration. Linking to the GitHub issue where it is being investigated/troubleshot:
https://github.com/microsoft/BotBuilder-V3/issues/208

How to capture action of hyperlinks of adaptive card in c#

I want to capture of action performed on hyperlink on Microsoft bot adaptive card. Using selection action I can capture the action but it's applicable for whole sentence. However, I want it to capture if it's clicked on link only. Below is my JSON template.
{
"type": "AdaptiveCard",
"body": [{
"type": "Container",
"items": [{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Test header",
"wrap": true
}],
"width": "stretch"
}]
},
{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"weight": "Bolder",
"text": "- first test [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",
"wrap": true
}],
"width": "stretch",
"selectAction": {
"type": "Action.OpenUrl",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
}]
},
{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"weight": "Bolder",
"text": "- second test [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",
"wrap": true
}],
"width": "stretch"
}]
},
{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"weight": "Bolder",
"text": "- third test [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",
"wrap": true
}],
"width": "stretch"
}]
}
]
}],
"backgroundImage": {
"url": "#",
"fillMode": "RepeatVertically"
},
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"id": "test"
}
Can you please guide me how can I achieve it?

Outlook API 555 Routing Failure when creating email draft

Our application has a feature that allows users to send emails directly from within the application using the Outlook Rest Api. We create a draft, optionally add attachments to it, and then send the email. This is done in C# using RestSharp.
Some of our users have run into issues when creating the draft. I have been unable to decipher what the error message really means, and if the correct answer is to just retry. (Some users manually try again and it appears to fail multiple times in quick succession). Those same users will then see successful emails sent later.
For reference, the api endpoint is: https://outlook.office.com/api/v2.0/me/messages and the reference documentation is here: https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations#CreateNewDraft
Sample Rest Response:
{
"Request": {
"AlwaysMultipartFormData": false,
"JsonSerializer": {
"ContentType": "application/json"
},
"XmlSerializer": {
"ContentType": "text/xml"
},
"UseDefaultCredentials": false,
"Parameters": [
{
"Name": "Authorization",
"Value": "Bearer [[REMOVED]]",
"Type": 3
},
{
"Name": "Content-Type",
"Value": "application/json; charset=utf-8",
"Type": 3
},
{
"Name": "application/json",
"Value": "[[MIME MESSAGE]]",
"Type": 4
},
{
"Name": "Accept",
"Value": "application/json, application/xml, text/json, text/x-json, text/javascript, text/xml",
"Type": 3
}
],
"Files": [],
"Method": 1,
"Resource": "api/v2.0/me/messages",
"RequestFormat": 1,
"OnBeforeDeserialization": {
"Delegate": {},
"method0": {
"Name": "<.ctor>b__0",
"AssemblyName": "RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null",
"ClassName": "RestSharp.RestRequest",
"Signature": "Void <.ctor>b__0(RestSharp.IRestResponse)",
"Signature2": "System.Void <.ctor>b__0(RestSharp.IRestResponse)",
"MemberType": 8,
"GenericArguments": null
}
},
"Timeout": 0,
"ReadWriteTimeout": 0,
"Attempts": 1
},
"ContentType": "",
"ContentLength": 0,
"ContentEncoding": "",
"Content": "",
"StatusCode": 555,
"StatusDescription": "Routing Failure",
"RawBytes": "",
"ResponseUri": "https://outlook.office.com/api/v2.0/me/messages",
"Server": "",
"Cookies": [
{
"Comment": "",
"Discard": false,
"Domain": "outlook.office.com",
"Expired": false,
"Expires": "2019-01-18T04:09:17+00:00",
"HttpOnly": true,
"Name": "exchangecookie",
"Path": "/",
"Port": "",
"Secure": false,
"TimeStamp": "2018-01-18T04:09:17.2631733+00:00",
"Value": "3b0a8015b9e24496bf28f9c6010e022a",
"Version": 0
},
{
"Comment": "",
"Discard": false,
"Domain": "outlook.office.com",
"Expired": false,
"Expires": "2018-01-18T04:24:17+00:00",
"HttpOnly": false,
"Name": "X-RouteRefreshCookie",
"Path": "/",
"Port": "",
"Secure": false,
"TimeStamp": "2018-01-18T04:09:17.2631733+00:00",
"Value": "zoHNz87H0s/O0s7Hq8/Lxc/Gxc7IgbKot6+tz8u8vs/Py8mBqoGwlpvFzZrOnsybzJvSzsqcx9LLy8zO0seempzSzsqdy53MyJyZz83N2svPycfIyMmanM3Syp6dndLLzMfJ0p6cy83SycqdnMjNy52Zms+dwruei56dnoyauIqWm8XPm5nPzM/KmdKbz8eb0svPz8fSncbOz9LPmsybzZzNzcbPx5vay8/Jx8jIyZqczdLKnp2d0svMx8nSnpzLzdLJyp2cyM3LnZmaz53ay8+RnpKPjZvNz9GPjZCb0ZCKi5OQkJTRnJCS2svPz7/OzM7Jz8jNzc7KyMzHzMzLyMc=",
"Version": 0
}
],
"Headers": [
{
"Name": "Set-Cookie",
"Value": "exchangecookie=3b0a8015b9e24496bf28f9c6010e022a; expires=Fri, 18-Jan-2019 04:09:17 GMT; path=/; HttpOnly,X-RouteRefreshCookie=zoHNz87H0s/O0s7Hq8/Lxc/Gxc7Igayxzq+tzsi8vs/PzsyBqoGwlpvFzZrOnsybzJvSzsqcx9LLy8zO0seempzSzsqdy53MyJyZz83N2svPycfIyMmanM3Syp6dndLLzMfJ0p6cy83SycqdnMjNy52Zms+dwruei56dnoyauIqWm8XPm5nPzM/KmdKbz8eb0svPz8fSncbOz9LPmsybzZzNzcbPx5vay8/Jx8jIyZqczdLKnp2d0svMx8nSnpzLzdLJyp2cyM3LnZmaz53ay8+RnpKPjZvNz9GPjZCb0ZCKi5OQkJTRnJCS2svPz7/OzM7Jz8jNzc7KyMzHzMzLyMc=; expires=Thu, 18-Jan-2018 04:24:17 GMT; path=/,X-RouteRefreshCookie=zoHNz87H0s/O0s7Hq8/Lxc/Gxc7IgbKot6+tz8u8vs/Py8mBqoGwlpvFzZrOnsybzJvSzsqcx9LLy8zO0seempzSzsqdy53MyJyZz83N2svPycfIyMmanM3Syp6dndLLzMfJ0p6cy83SycqdnMjNy52Zms+dwruei56dnoyauIqWm8XPm5nPzM/KmdKbz8eb0svPz8fSncbOz9LPmsybzZzNzcbPx5vay8/Jx8jIyZqczdLKnp2d0svMx8nSnpzLzdLJyp2cyM3LnZmaz53ay8+RnpKPjZvNz9GPjZCb0ZCKi5OQkJTRnJCS2svPz7/OzM7Jz8jNzc7KyMzHzMzLyMc=; expires=Thu, 18-Jan-2018 04:24:17 GMT; path=/",
"Type": 3
},
{
"Name": "request-id",
"Value": "ab8da322-62ac-4c32-b92b-accd590d7aaf",
"Type": 3
},
{
"Name": "X-CalculatedFETarget",
"Value": "SN1PR17CU001.internal.outlook.com",
"Type": 3
},
{
"Name": "X-BackEndHttpStatus",
"Value": "555,555",
"Type": 3
},
{
"Name": "X-FEProxyInfo",
"Value": "SN1PR17CA0013.NAMPRD17.PROD.OUTLOOK.COM",
"Type": 3
},
{
"Name": "X-CalculatedBETarget",
"Value": "SN1PR20MB0286.namprd20.prod.outlook.com",
"Type": 3
},
{
"Name": "x-ms-appId",
"Value": "8410d572-e055-48e5-b2c7-869538daf671",
"Type": 3
},
{
"Name": "X-BEServerRoutingError",
"Value": "Mailbox database change detected; moved from database 0fd6794b-0d64-4c64-be98-dc8157675f93 to 0df0305f-d08d-4008-b910-0e3d2c22908d",
"Type": 3
},
{
"Name": "X-DiagInfo",
"Value": "SN1PR20MB0286",
"Type": 3
},
{
"Name": "X-BEServer",
"Value": "SN1PR20MB0286",
"Type": 3
},
{
"Name": "X-FEServer",
"Value": "SN1PR17CA0013,MWHPR04CA0046",
"Type": 3
},
{
"Name": "X-Powered-By",
"Value": "ASP.NET",
"Type": 3
},
{
"Name": "X-MSEdge-Ref",
"Value": "Ref A: A07C0D2FC267430AA8A2AEEEA095E277 Ref B: BAYEDGE0211 Ref C: 2018-01-18T04:09:17Z",
"Type": 3
},
{
"Name": "Date",
"Value": "Thu, 18 Jan 2018 04:09:16 GMT",
"Type": 3
},
{
"Name": "Content-Length",
"Value": "0",
"Type": 3
}
],
"ResponseStatus": 1
}
Note: I've removed some details like the message itself and the bearer token. If it's necessary for debugging, I can obfuscate and include the information again.
UPDATE: It appears that the error code has changed to 503 Service Unavailable instead of 555 Routing Failure, but the details seem to be the same. The key response header is "X-BEServerRoutingError" that contains a value like "Mailbox database change detected; moved from database [guid] to [guid]". Based on the response from this SO question: Office365 API Error "Mailbox database change detected;", it appears that this is a known transient issue and the resolution is to just retry. There doesn't seem to be any guidance on amount of times to retry or anything like that. Still on the lookout for an answer that has proper guidance.
After a long support ticket conversation with Microsoft, their guidance was to add a retry policy.
My example above doesn't show it, but there is usually a header with the name of "X-Retry-After" that has an integer value that represents minutes. If the value is 0, it means to retry immediately.
After implementing the retry policy, we haven't seen anymore errors for roughly a week and a half.

Create DropDown list for jira custom field in REST API

I'm trying to retrieve the available options for fields through the Jira REST API but I'm getting stuck on the custom fields.
A normal field returns something like this:
{[priority, {
"required": false,
"schema": {
"type": "priority",
"system": "priority"
},
"name": "Priority",
"key": "priority",
"hasDefaultValue": true,
"operations": [
"set"
],
"allowedValues": [
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/1",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/highest.svg",
"name": "Highest",
"id": "1"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/2",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/high.svg",
"name": "High",
"id": "2"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/3",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/4",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/low.svg",
"name": "Low",
"id": "4"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/5",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/lowest.svg",
"name": "Lowest",
"id": "5"
}
],
"defaultValue": {
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/3",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
}
}]}
The custom fields on the other hand return a much "smaller" set!
"Sprint" Custom Field:
{[customfield_10113, {
"required": false,
"schema": {
"type": "array",
"items": "string",
"custom": "com.pyxis.greenhopper.jira:gh-sprint",
"customId": 10113
},
"name": "Sprint",
"key": "customfield_10113",
"hasDefaultValue": false,
"operations": [
"set"
]
}]}
"Epic Link"
{[customfield_10006, {
"required": false,
"schema": {
"type": "any",
"custom": "com.pyxis.greenhopper.jira:gh-epic-link",
"customId": 10006
},
"name": "Epic Link",
"key": "customfield_10006",
"hasDefaultValue": false,
"operations": [
"set"
]
}]}
As you can see there are no options available, but i know that there are.
How can I get to these values through rest?
I have tried checking the request that the cloud server makes but it's pretty different for each of the custom fields and i cannot find a relation between them. For example:
To get the sprint possible values: https://inn-inw.atlassian.net/rest/greenhopper/1.0/sprint/picker?query=
and to get the Epic values: https://inn-inw.atlassian.net/rest/greenhopper/1.0/epics
I'm trying to make things as clean as possible and I would prefer not to hard code the request, specially because i would probably need to update the code every time a new custom field is created.
PS: I have tried some of the solutions presented in other questions but couldn't find one that fits what i need. eg: https://inn-inw.atlassian.net//rest/api/2/issue/createmeta?projectKeys=PROJKEY&issuetypeNames=Bug&expand=projects.issuetypes.fields returns only the short description that is displayed above.

Categories

Resources