How To Filter Postman API Results - api

I am running this GET API query in Postman - https://[myDomain].atlassian.net/wiki/rest/api/space/ which returns the below results.
However, I'd like to filter out the results to display or return only some specific data, e.g. only the id, key, name, homepage and webui values. How can I achieve this in Postman?
{
"results": [
{
"id": 98430,
"key": "DOC",
"name": "Documents",
"type": "global",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/DOC/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=DOC",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/DOC/theme",
"history": "",
"homepage": "/rest/api/content/98633"
},
"_links": {
"webui": "/spaces/DOC",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/DOC"
}
},
{
"id": 425986,
"key": "~63be918f98bf50328c68aec2",
"name": "MyDocs",
"type": "personal",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/~63be918f98bf50328c68aec2/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~63be918f98bf50328c68aec2",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/~63be918f98bf50328c68aec2/theme",
"history": "",
"homepage": "/rest/api/content/426171"
},
"_links": {
"webui": "/spaces/~63be918f98bf50328c68aec2",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/~63be918f98bf50328c68aec2"
}
},
{
"id": 2064386,
"key": "~5f7af04cb61f66006f28fafc",
"name": "Content Management",
"type": "personal",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/~5f7af04cb61f66006f28fafc/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~5f7af04cb61f66006f28fafc",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/~5f7af04cb61f66006f28fafc/theme",
"history": "",
"homepage": "/rest/api/content/2064576"
},
"_links": {
"webui": "/spaces/~5f7af04cb61f66006f28fafc",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/~5f7af04cb61f66006f28fafc"
}
},
{
"id": 98306,
"key": "~5f7aef9c8d88b300751faba5",
"name": "AI Development",
"type": "personal",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/~5f7aef9c8d88b300751faba5/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~5f7aef9c8d88b300751faba5",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/~5f7aef9c8d88b300751faba5/theme",
"history": "",
"homepage": "/rest/api/content/98389"
},
"_links": {
"webui": "/spaces/~5f7aef9c8d88b300751faba5",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/~5f7aef9c8d88b300751faba5"
}
},
{
"id": 229380,
"key": "SD",
"name": "Software Development",
"type": "global",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/SD/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=SD",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/SD/theme",
"history": "",
"homepage": "/rest/api/content/229464"
},
"_links": {
"webui": "/spaces/SD",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/SD"
}
}
],
"start": 0,
"limit": 25,
"size": 5,
"_links": {
"base": "https://xxxxxx.atlassian.net/wiki",
"context": "/wiki",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/"
}
}

IMO, you can't directly filter results to show in postman response tab.
However, you can achieve your goals by 2 work-arounds.
Use visualization function:
Put this code to your Tests tab
var template = `
<table bgcolor="#FFFFFF">
<tr>
<th>id</th>
<th>key</th>
<th>name</th>
<th>homepage</th>
<th>webui</th>
</tr>
{{#each response}}
<tr>
<td>{{id}}</td>
<td>{{key}}</td>
<td>{{name}}</td>
<td>{{_expandable.homepage}}</td>
<td>{{_links.webui}}</td>
</tr>
{{/each}}
</table>
`;
pm.visualizer.set(template, {
response: pm.response.json().results
});
Use logging function:
Put this code to your Tests tab
const res = pm.response.json().results;
res.forEach(e => {
let x = {
"id": e.id,
"key": e.key,
"name": e.name,
"homepage": e._expandable.homepage,
"webuid": e._links.webui
}
console.log(x)
})

Related

How to map an array within an array and achieve the following output?

In the given input,
{
"editable": true,
"sections": [
{
"title": "Identification",
"calingaKey": "",
"content": [
[{
"name": "Classification",
"text": "Product",
"url": "",
"info": ""
},
{
"name": "Product Number",
"text": "####1234",
"url": "",
"info": ""
}]
]
},
{
"title": "Position and Contact",
"calingaKey": "",
"content": [
[{
"name": "Manufacturer",
"text": "Value of Manufacturer",
"url": "",
"info": ""
},
{
"name": "Hardware Version",
"text": "####1234",
"url": "",
"info": ""
}]
]
}
]
}
"content" is an array of array of objects. Basically, the "name" field has to be replaced by values stored in their corresponding keys in the "calinga" variable.
I could do it for the "title" field, but each "name" field should also be replaced by it's name in the variable.
%dw 2.0
output application/json
var calinga = {
"Identification": "Identifikation",
"Position and Contact": "Positions und Contacts",
"Classification": "Classifikation",
"Product Number": "Produkt Number",
"Manufacturer": "Manufakturer",
"Hardware Version": "Hware Vsion"
}
---
{
"editable": payload.editable,
"sections": payload.sections map(item01, index01)->{
"title": calinga[item01.title],
"content": item01.content map(item02)->(item02)
}
}
How Can I achieve the following output?
{
"editable": true,
"sections": [
{
"title": "Identifikation",
"calingaKey": "",
"content": [
[{
"name": "Classifikation",
"text": "Product",
"url": "",
"info": ""
},
{
"name": "Produkt Number",
"text": "####1234",
"url": "",
"info": ""
}]
]
},
{
"title": "Positions und Contacts",
"calingaKey": "",
"content": [
[{
"name": "Manufakturer",
"text": "Value of Manufacturer",
"url": "",
"info": ""
},
{
"name": "Hware Vsion",
"text": "####1234",
"url": "",
"info": ""
}]
]
}
]
}
You can use mapObject() once you descend from the last nested array into objects. Then the trick is to use the value of calinga but if it null because the key is not present then use the original value as the default: item03 mapObject {($$):calinga[$] default $}.
Example:
%dw 2.0
output application/json
var calinga = {
"Identification": "Identifikation",
"Position and Contact": "Positions und Contacts",
"Classification": "Classifikation",
"Product Number": "Produkt Number",
"Manufacturer": "Manufakturer",
"Hardware Version": "Hware Vsion"
}
---
{
"editable": payload.editable,
"sections": payload.sections map(item01, index01)->{
"title": calinga[item01.title],
"content": item01.content map(item02)->(item02 map(item03)-> item03 mapObject {($$):calinga[$] default $})
}
}

Transferring ownership of NFT(ERC721)

I'm trying to change the ownership of a requested ERC721(NFT) to another wallet.
I'm using the Mumbai Test Net and ethers.
To do it I need to create the general ERC721 contract using its abi but I can't find it.
In comparison, the ERC20's abi I found easily - link and used it like followed and it's working:
const createERC20Contract = (contractAddress) => {
const provider = new ethers.providers.Web3Provider(ethereum);
const signer = provider.getSigner();
const ERC20Contract = new ethers.Contract(contractAddress, ERC20ABI, signer);
return ERC20Contract;
}
Where can I find the abi of ERC721 to create the ethers.Contract() ?
Here's a generic ERC721 ABI that I built from the OpenZeppelin implementation. (The bare minimum contract - none of their extensions such as mint and burn tokens.)
[
{
"inputs": [
{
"internalType": "string",
"name": "name_",
"type": "string"
},
{
"internalType": "string",
"name": "symbol_",
"type": "string"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

Bot duplicates user messages when I use DirectLine channel

I am using bot framework v4. I have developed a chatbot using .Net Core. The bot is integrated with LUIS and Qna Maker. One issue I am facing is that the bot duplicates the message that comes from the user. Please look at the screenshot below:
The replies I get from the bot are perfectly fine. The flow of the bot is as intended. I just cannot figure out why the message from user is being duplicated. I am using DirectLine for this. I will share whatever code part is needed.
{
"activities": [
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000000",
"timestamp": "2019-12-02T19:41:57.1284328Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"size": "large",
"url": "https://i.imgur.com/ViaEUnA.png"
}
]
}
],
"horizontalAlignment": "Center"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "Welcome to CIVIC Financial Services",
"wrap": true
},
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "I am S.U.E",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "I can help you answer your questions. Familiarize yourself with CIVIC Financial Services.",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "If you want to talk to a Customer Service Agent, just type \"I want to talk to a Customer Service Agent\".",
"wrap": true
}
],
"separator": true,
"horizontalAlignment": "Left"
}
]
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"data": {
"action": "aboutCivic"
},
"title": "About CIVIC"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"actions": [
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "We are open from Monday through Friday from 8:00am to 6:00pm.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "When are you open?"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Image",
"size": "stretch",
"url": "https://i.imgur.com/gBVgI25.png",
"horizontalAlignment": "center"
},
{
"type": "TextBlock",
"text": "AZ, CA, CO, FL, GA, HI, NC, NV, OR, SC, TN, TX, UT, VA & WA",
"wrap": true
}
],
"style": "emphasis"
},
"title": "Do you have an office near me? "
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "8 to 10 days, it all depends on how it takes to get access to the property.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "How quickly can we close? "
}
],
"style": "emphasis"
},
"title": "FAQs"
}
]
}
}
],
"entities": [],
"replyToId": "8WGOnspSxN3"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000001",
"timestamp": "2019-12-02T19:43:39.96502Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"entities": [
{
"type": "ClientCapabilities",
"requiresBotState": true,
"supportsListening": true,
"supportsTts": true
}
],
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000002",
"timestamp": "2019-12-02T19:43:41.7278914Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000001"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000003",
"timestamp": "2019-12-02T20:00:25.784598Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "helo",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000004",
"timestamp": "2019-12-02T20:00:26.5739342Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000003"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000005",
"timestamp": "2019-12-02T20:00:27.3293896Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "hello",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000006",
"timestamp": "2019-12-02T20:00:27.6064185Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Hello",
"inputHint": "acceptingInput",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000005"
}
],
"watermark": "6"
}

How to use If command in the selenium ide?

I was searching the web for a long time. I'm trying to put if and else statements into this selenium IDE. The program itself doesn't provide any parameters, hints, or help. I saw a lot of results online where it's just java code, however I don't see anyway to enter code here.
Can someone show me an example of how to use this if and then statement?
Basic if condition example:
Example .side file. Save the below code in file with name as 'Test.side' and open in selenium ide
{
"id": "92a8cfe0-a7ed-45a4-82c2-59f889cba0a6",
"version": "1.1",
"name": "test",
"url": "",
"tests": [{
"id": "f78b739a-886c-4842-9d61-f83700ef29f6",
"name": "test",
"commands": [{
"id": "ff43b0cf-7207-4599-8f11-3f90102cd1e2",
"comment": "",
"command": "open",
"target": "https://in.yahoo.com",
"targets": [],
"value": ""
}, {
"id": "12efa973-069b-4254-9813-868d4a34876d",
"comment": "",
"command": "storeTitle",
"target": "",
"targets": [],
"value": "title"
}, {
"id": "abde904f-6f3f-4a5a-b24a-59c3b2eafe2c",
"comment": "",
"command": "if",
"target": "${title} != 'Google'",
"targets": [],
"value": ""
}, {
"id": "bb6640f2-6356-439f-b226-287030e8fa5a",
"comment": "",
"command": "open",
"target": "https://www.google.com",
"targets": [],
"value": ""
}, {
"id": "ee3b8144-4981-460d-b707-e925e52ebe41",
"comment": "",
"command": "assertTitle",
"target": "Google",
"targets": [],
"value": ""
}, {
"id": "f73c9836-4944-45aa-be07-9647991ffb36",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "bcc2bd2b-5091-4b40-b499-f89c38e532bf",
"comment": "",
"command": "sendKeys",
"target": "name=q",
"targets": [],
"value": "Hello world"
}]
}],
"suites": [{
"id": "e966e7ba-8ccd-418a-80e7-f99ac6c25f90",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["f78b739a-886c-4842-9d61-f83700ef29f6"]
}],
"urls": [],
"plugins": []
}
If with else Example
Example .side file.
{
"id": "92a8cfe0-a7ed-45a4-82c2-59f889cba0a6",
"version": "1.1",
"name": "test",
"url": "",
"tests": [{
"id": "f78b739a-886c-4842-9d61-f83700ef29f6",
"name": "test",
"commands": [{
"id": "ff43b0cf-7207-4599-8f11-3f90102cd1e2",
"comment": "",
"command": "open",
"target": "https://www.google.com",
"targets": [],
"value": ""
}, {
"id": "12efa973-069b-4254-9813-868d4a34876d",
"comment": "",
"command": "storeTitle",
"target": "",
"targets": [],
"value": "title"
}, {
"id": "abde904f-6f3f-4a5a-b24a-59c3b2eafe2c",
"comment": "",
"command": "if",
"target": "${title} == 'Google'",
"targets": [],
"value": ""
}, {
"id": "bb6640f2-6356-439f-b226-287030e8fa5a",
"comment": "",
"command": "echo",
"target": "I am in Yahoo Page",
"targets": [],
"value": ""
}, {
"id": "ee3b8144-4981-460d-b707-e925e52ebe41",
"comment": "",
"command": "assertTitle",
"target": "Google",
"targets": [],
"value": ""
}, {
"id": "f73c9836-4944-45aa-be07-9647991ffb36",
"comment": "",
"command": "else",
"target": "",
"targets": [],
"value": ""
}, {
"id": "a90e7c75-911a-46cb-ac52-a3fd394e6dfe",
"comment": "",
"command": "echo",
"target": "I am in already in google Page",
"targets": [],
"value": ""
}, {
"id": "2b29d6fe-a670-4349-be18-794e85fbd498",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "7f8ee438-4dae-4f34-b4b6-7a4a166acabf",
"comment": "",
"command": "sendKeys",
"target": "q=name",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "e966e7ba-8ccd-418a-80e7-f99ac6c25f90",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["f78b739a-886c-4842-9d61-f83700ef29f6"]
}],
"urls": [],
"plugins": []
}
If with ElseIf Example
Example selenium ide test file (.side)
{
"id": "92a8cfe0-a7ed-45a4-82c2-59f889cba0a6",
"version": "1.1",
"name": "test",
"url": "",
"tests": [{
"id": "f78b739a-886c-4842-9d61-f83700ef29f6",
"name": "test",
"commands": [{
"id": "ff43b0cf-7207-4599-8f11-3f90102cd1e2",
"comment": "",
"command": "open",
"target": "https://www.google.com",
"targets": [],
"value": ""
}, {
"id": "12efa973-069b-4254-9813-868d4a34876d",
"comment": "",
"command": "storeTitle",
"target": "",
"targets": [],
"value": "title"
}, {
"id": "abde904f-6f3f-4a5a-b24a-59c3b2eafe2c",
"comment": "",
"command": "if",
"target": "${title} == 'Google'",
"targets": [],
"value": ""
}, {
"id": "bb6640f2-6356-439f-b226-287030e8fa5a",
"comment": "",
"command": "echo",
"target": "I am in Yahoo Page",
"targets": [],
"value": ""
}, {
"id": "ee3b8144-4981-460d-b707-e925e52ebe41",
"comment": "",
"command": "assertTitle",
"target": "Google",
"targets": [],
"value": ""
}, {
"id": "f73c9836-4944-45aa-be07-9647991ffb36",
"comment": "",
"command": "elseIf",
"target": "${title} != 'Yahoo'",
"targets": [],
"value": ""
}, {
"id": "a90e7c75-911a-46cb-ac52-a3fd394e6dfe",
"comment": "",
"command": "echo",
"target": "I am in google Page",
"targets": [],
"value": ""
}, {
"id": "2b29d6fe-a670-4349-be18-794e85fbd498",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "bcc2bd2b-5091-4b40-b499-f89c38e532bf",
"comment": "",
"command": "echo",
"target": "I am out side the if condition",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "e966e7ba-8ccd-418a-80e7-f99ac6c25f90",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["f78b739a-886c-4842-9d61-f83700ef29f6"]
}],
"urls": [],
"plugins": []
}

LINQ to SQL outputting different than intended, how to resolve?

Background on the project:
DB and site hosted on Azure, developing in VS 2015.
I am trying to display all rows for all entries in one of my tables and the output I am getting is different than what I was expecting. I am not sure if it is because of my coding or because of how the table was created or for some other reason I'm not thinking of so any help is appreciated.
Here is my code to pull it from DB(in a file named EmployeesRepository):
public static List<Employee> GetAllEmployees()
{
return dataContext.Employees.ToList();
}
Here is my code to send that data to a controller(in a file named EmployeesController):
[Route("api/employees")]
public HttpResponseMessage Get()
{
var employees = EmployeesRepository.GetAllEmployees();
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, employees);
return response;
}
and here is the angular code to write it out(in my employees.html file):
<table class="table table-striped table-hover" style="width:100%">
<thead>
<tr class="info">
<th ng-click="doSort('username')">Username</th>
<th ng-click="doSort('firstName')">First Name</th>
<th ng-click="doSort('lastName')">Last Name</th>
<th ng-click="doSort('ext')">Extension</th>
<th ng-click="doSort('location')">Location</th>
<th ng-click="doSort('jobtitle')">Job Title</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="Employee in Employees | filter:textFilter | orderBy:sortBy:reverse">
<td>{{ Employee.username }}</td>
<td>{{ Employee.firstName }}</td>
<td>{{ Employee.lastName }}</td>
<td>{{ Employee.ext }}</td>
<td>{{ Employee.location }}</td>
<td>{{ Employee.jobtitle }}</td>
</tr>
</tbody>
</table>
What it seems to be doing is pulling all foreign keys and creating references for the rest of the data, and angular doesn't know how to output the references. I will provide the JSON output i grabbed from POSTman so you can see whats its doing. The angular correctly identifies 6 objects in my table, and allots 6 rows for the data, but only the first record is displayed, the rest are just blank spaces. Any suggestions as to why its doing this?
[
{
"$id": "1",
"location1": {
"$id": "2",
"employees": [
{
"$ref": "1"
},
{
"$id": "3",
"location1": {
"$ref": "2"
},
"equipments": [
{
"$id": "4",
"employee": {
"$ref": "3"
},
"tickets": [
{
"$id": "5",
"employee": {
"$ref": "3"
},
"employee1": {
"$id": "6",
"location1": {
"$id": "7",
"employees": [
{
"$ref": "6"
}
],
"id": 1,
"locName": "Prime BR Clinic",
"addrss": "1481 Airline Hwy",
"phoneNum": "225-778-0000"
},
"equipments": [],
"tickets": [],
"tickets1": [
{
"$ref": "5"
},
{
"$id": "8",
"employee": {
"$ref": "3"
},
"employee1": {
"$ref": "6"
},
"equipment": {
"$id": "9",
"employee": {
"$ref": "1"
},
"tickets": [
{
"$ref": "8"
}
],
"barcode": "PTR-000000001",
"condition": "InUse",
"assignedTo": "ebeyj",
"notes": "Runs very slow.",
"configDate": "1905-07-03T00:00:00"
},
"id": 3,
"title": "Fake Ticket",
"customer": "landrya",
"barcode": "PTR-000000001",
"assignedTo": "hofmannr",
"category": "Installation",
"importance": "low",
"openDate": "1905-06-05T00:00:00",
"dueDate": "1905-06-05T00:00:00",
"closedDate": "1905-06-05T00:00:00",
"comments": " ",
"condition": "Closed",
"workHours": 99
}
],
"username": "landrya",
"email": "landrya#*****.com",
"lastName": "Landry",
"firstName": "Ashley",
"ext": 4300,
"location": 1,
"jobtitle": "HR Rep"
},
"equipment": {
"$ref": "4"
},
"id": 0,
"title": "Fake Ticket",
"customer": "landrya",
"barcode": "COM-000000001",
"assignedTo": "hofmannr",
"category": "TroubleShoot",
"importance": "low",
"openDate": "1905-06-05T00:00:00",
"dueDate": "1905-06-05T00:00:00",
"closedDate": "1905-06-05T00:00:00",
"comments": "VPNs are a piece of SSH IT",
"condition": "Closed",
"workHours": 99
}
],
"barcode": "COM-000000001",
"condition": "InUse",
"assignedTo": "hofmannr",
"notes": null,
"configDate": "1905-06-20T00:00:00"
}
],
"tickets": [
{
"$ref": "5"
},
{
"$ref": "8"
}
],
"tickets1": [],
"username": "hofmannr",
"email": "hofmannr#******.com",
"lastName": "Hofmann",
"firstName": "Ritchie",
"ext": 5002,
"location": 0,
"jobtitle": "IT GURU"
},
{
"$id": "10",
"location1": {
"$ref": "2"
},
"equipments": [
{
"$id": "11",
"employee": {
"$ref": "10"
},
"tickets": [
{
"$id": "12",
"employee": {
"$ref": "1"
},
"employee1": {
"$ref": "10"
},
"equipment": {
"$ref": "11"
},
"id": 2,
"title": "Imaginary Ticket",
"customer": "mcmorrisv",
"barcode": "MON-000000001",
"assignedTo": "ebeyj",
"category": "TroubleShoot",
"importance": "mid",
"openDate": "1905-06-20T00:00:00",
"dueDate": "1905-06-15T00:00:00",
"closedDate": null,
"comments": null,
"condition": "Open",
"workHours": 0
}
],
"barcode": "MON-000000001",
"condition": "Terminated",
"assignedTo": "mcmorrisv",
"notes": null,
"configDate": "1905-06-17T00:00:00"
}
],
"tickets": [],
"tickets1": [
{
"$ref": "12"
}
],
"username": "mcmorrisv",
"email": "mcmorrisv#******.com",
"lastName": "McMorris",
"firstName": "Vivian",
"ext": 4200,
"location": 0,
"jobtitle": "I am sure she does something around here."
},
{
"$id": "13",
"location1": {
"$ref": "2"
},
"equipments": [],
"tickets": [],
"tickets1": [
{
"$id": "14",
"employee": {
"$id": "15",
"location1": {
"$ref": "2"
},
"equipments": [],
"tickets": [
{
"$ref": "14"
}
],
"tickets1": [],
"username": "xier",
"email": "xier#******.com",
"lastName": "Xie",
"firstName": "Richard",
"ext": 5000,
"location": 0,
"jobtitle": "IT Paladin"
},
"employee1": {
"$ref": "13"
},
"equipment": {
"$id": "16",
"employee": null,
"tickets": [
{
"$ref": "14"
}
],
"barcode": "COM-000000002",
"condition": "StandBy",
"assignedTo": null,
"notes": null,
"configDate": "1905-07-07T00:00:00"
},
"id": 1,
"title": "Pseudo-Ticket",
"customer": "pans",
"barcode": "COM-000000002",
"assignedTo": "xier",
"category": "Special Request",
"importance": "high",
"openDate": "1926-11-02T00:00:00",
"dueDate": "1926-11-02T00:00:00",
"closedDate": null,
"comments": "Developer accused of undocumented code refuses to cmnt",
"condition": "Open",
"workHours": -1
}
],
"username": "pans",
"email": "pans#******.com",
"lastName": "Pan",
"firstName": "Sharon",
"ext": 4100,
"location": 0,
"jobtitle": "Accounts Payable Manager"
},
{
"$ref": "15"
}
],
"id": 0,
"locName": "Prime Corp",
"addrss": "1481 Airline Hwy",
"phoneNum": "225-408-0000"
},
"equipments": [
{
"$ref": "9"
}
],
"tickets": [
{
"$ref": "12"
}
],
"tickets1": [],
"username": "ebeyj",
"email": "ebeyj#******.com",
"lastName": "Ebey",
"firstName": "Joseph",
"ext": 5001,
"location": 0,
"jobtitle": "IT Jedi"
},
{
"$ref": "3"
},
{
"$ref": "6"
},
{
"$ref": "10"
},
{
"$ref": "13"
},
{
"$ref": "15"
}
]
The issue arises because you have shared objects (or potentially shared objects), and then are serializing them to JSON. This article explains it in detail: http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization.
You should also read: Using JavaScript to deserialize references in a complex object graph from SignalR/Json.NET