cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
russrimm1
Helper I
Helper I

JSON and Response

Hi all,

I've been battling with getting some json right to return to PowerApps.  The collection shows all the columns, but there's no data even though the output has all the data.


Here's my HTTP output:

{
  "value": [
    {
      "@odata.etag""16777249",
      "__LAZYPROPERTIES": [
        "__QUALIFIER_SECURITYVERBS"
      ],
      "__QUALIFIER_SECURITYVERBS"null,
      "AADDeviceID""A661F6EA-23D7-418C-9BAF------",
      "AADTenantID""3BED4936-29FC-4C87-8485------",
      "Active"1,
      "ADSiteName""RussLab",
      "AgentName": [
        "SMS_WINNT_SERVER_DISCOVERY_AGENT",
        "SMS_AD_SYSTEM_DISCOVERY_AGENT",
        "SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT",
        "MP_ClientRegistration",
        "Heartbeat Discovery",
        "PFE Remediation"
      ],
      "AgentSite": [
        "PRI"
      ],
      "AgentTime": [
        "2020-12-07T18:12:01Z"
      ],
      "AlwaysInternet"0,
      "AMTFullVersion"null,
      "AMTStatus"null,
      "Build""10.0.17763",
      "BuildExt""10.0.17763.1518",
      "Client"1,
      "ClientEdition"0,
      "ClientType"1,
      "ClientVersion""5.00.9040.1015",
      "CPUType""Intel64 Family 6 Model 45 Stepping 7",
      "CreationDate""2019-07-02T22:14:37Z",
      "Decommissioned"0,
      "DeviceOwner"1,
      "DisableWindowsUpdateAccess"null,
      "DistinguishedName""CN=FS01,OU=AAD Sync,DC=contoso,DC=com",
      "DNSForestGuid""12C70764-97F1-4257-91E6-9EB56301FC53",
      "DoNotConnectToWULocations"null,
      "EASDeviceID"null,
      "ESUValue""00000000-0000-0000-0000-000000000000",
      "FullDomainName""CONTOSO.COM",
      "HardwareID""2:B647D8CF1EB01CB11BA844E2F1A8CCDD2BB2EA6D",
      "InternetEnabled"1,
      "IPAddresses": [
        "192.168.10.130"
      ],
      "IPSubnets": [
        "192.168.10.0"
      ],
      "IPv6Addresses": [
        "2600:1700:0F20:73D0:0000:0000:0000:0038"
      ],
      "IPv6Prefixes": [
        "2600:1700:0F20:73D0"
      ],
      "IsAOACCapable"false,
      "IsAssignedToUser"true,
      "IsClientAMT30Compatible"null,
      "IsMachineChangesPersisted"true,
      "IsPortableOperatingSystem"false,
      "IsVirtualMachine"true,
      "IsWriteFilterCapable"false,
      "LastLogonTimestamp""2020-12-06T23:00:22Z",
      "LastLogonUserDomain"null,
      "LastLogonUserName"null,
      "MACAddresses": [
        "00:15:5D:E5:B6:15",
        "00:15:5D:E5:B6:16"
      ],
      "ManagementAuthority"0,
      "MDMComplianceStatus"null,
      "MDMDeviceCategoryID"null,
      "Name""FS01",
      "NetbiosName""FS01",
      "ObjectGUID""6vZhptcjjEGbr18HY9xsaA==",
      "Obsolete"0,
      "OperatingSystemNameandVersion""Microsoft Windows NT Server 10.0",
      "OSBranch""2",
      "PreviousSMSUUID""GUID:60AF55E8-E5B2-4F7D-AE03-342845A9B9E7",
      "PrimaryGroupID"515,
      "PublisherDeviceID"null,
      "pwdLastSet"132517919482447150,
      "ResourceDomainORWorkgroup""CONTOSO",
      "ResourceId"16777249,
      "ResourceNames": [
        "FS01.CONTOSO.com"
      ],
      "ResourceType"5,
      "SecurityGroupName": [],
      "SenseID"null,
      "SerialNumber"null,
      "SID""S-1-5-21-470498376-2818351429-2247872160-1118",
      "SiteCode""PRI",
      "SMBIOSGUID""13479FCD-8214-4F0B-A6D6",
      "SMSAssignedSites": [
        "PRI"
      ],
      "SMSInstalledSites": [
        "PRI"
      ],
      "SMSResidentSites": [
        "PRI"
      ],
      "SMSUniqueIdentifier""GUID:60AF55E8-E5B2-4F7D-AE03-342845A9B9E7",
      "SMSUUIDChangeDate""2020-12-04T03:37:05Z",
      "SNMPCommunityName"null,
      "SuppressAutoProvision"null,
      "SystemContainerName": [],
      "SystemGroupName": [],
      "SystemOUName": [
        "CONTOSO.COM/AAD SYNC"
      ],
      "SystemRoles": [
        "SMS Distribution Point",
        "SMS Site System"
      ],
      "Unknown"null,
      "UserAccountControl"4096,
      "VirtualMachineHostName""RIMLAB",
      "VirtualMachineType"1,
      "WipeStatus"null,
      "WTGUniqueKey"null,
      "__GENUS"2,
      "__CLASS""SMS_R_System",
      "__SUPERCLASS""SMS_Resource",
      "__DYNASTY""SMS_BaseClass",
      "__RELPATH""SMS_R_System.ResourceId=16777249",
      "__PROPERTY_COUNT"114,
      "__DERIVATION": [
        "SMS_Resource",
        "SMS_BaseClass"
      ],
      "__SERVER""PRI1",
      "__NAMESPACE""root\\sms\\site_PRI",
      "__PATH""\\\\PRI1\\root\\sms\\site_PRI:SMS_R_System.ResourceId=16777249"
    }
  ]
}
 
Here's the schema i'm unsuccessfully trying and getting no results:
 
{
    "type""object",
    "properties": {
        "AADDeviceID": {
            "type""string"
        },
        "AADTenantID": {
            "type""string"
        },
        "Active": {
            "type""integer"
        },
        "ADSiteName": {
            "type""string"
        },
        "AgentName": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "AgentSite": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "AgentTime": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "AlwaysInternet": {
            "type""integer"
        },
        "AMTFullVersion": {},
        "AMTStatus": {},
        "Build": {
            "type""string"
        },
        "BuildExt": {
            "type""string"
        },
        "Client": {
            "type""integer"
        },
        "ClientEdition": {
            "type""integer"
        },
        "ClientType": {
            "type""integer"
        },
        "ClientVersion": {
            "type""string"
        },
        "CPUType": {
            "type""string"
        },
        "CreationDate": {
            "type""string"
        },
        "Decommissioned": {
            "type""integer"
        },
        "DeviceOwner": {
            "type""integer"
        },
        "DisableWindowsUpdateAccess": {},
        "DistinguishedName": {
            "type""string"
        },
        "DNSForestGuid": {
            "type""string"
        },
        "DoNotConnectToWULocations": {},
        "EASDeviceID": {},
        "ESUValue": {
            "type""string"
        },
        "FullDomainName": {
            "type""string"
        },
        "HardwareID": {
            "type""string"
        },
        "InternetEnabled": {
            "type""integer"
        },
        "IPAddresses": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "IPSubnets": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "IPv6Addresses": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "IPv6Prefixes": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "IsAOACCapable": {
            "type""boolean"
        },
        "IsAssignedToUser": {
            "type""boolean"
        },
        "IsClientAMT30Compatible": {},
        "IsMachineChangesPersisted": {
            "type""boolean"
        },
        "IsPortableOperatingSystem": {
            "type""boolean"
        },
        "IsVirtualMachine": {
            "type""boolean"
        },
        "IsWriteFilterCapable": {
            "type""boolean"
        },
        "LastLogonTimestamp": {
            "type""string"
        },
        "LastLogonUserDomain": {},
        "LastLogonUserName": {},
        "MACAddresses": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "ManagementAuthority": {
            "type""integer"
        },
        "MDMComplianceStatus": {},
        "MDMDeviceCategoryID": {},
        "Name": {
            "type""string"
        },
        "NetbiosName": {
            "type""string"
        },
        "ObjectGUID": {
            "type""string"
        },
        "Obsolete": {
            "type""integer"
        },
        "OperatingSystemNameandVersion": {
            "type""string"
        },
        "OSBranch": {
            "type""string"
        },
     
        },
        "PreviousSMSUUID": {
            "type""string"
        },
        "PrimaryGroupID": {
            "type""integer"
        },
        "PublisherDeviceID": {},
        "pwdLastSet": {
            "type""integer"
        },
        "ResourceDomainORWorkgroup": {
            "type""string"
        },
        "ResourceId": {
            "type""integer"
        },
        "ResourceNames": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "ResourceType": {
            "type""integer"
        },
        "SecurityGroupName": {
            "type""array"
        },
        "SenseID": {},
        "SerialNumber": {},
        "SID": {
            "type""string"
        },
        "SiteCode": {
            "type""string"
        },
        "SMBIOSGUID": {
            "type""string"
        },
        "SMSAssignedSites": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "SMSInstalledSites": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "SMSResidentSites": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "SMSUniqueIdentifier": {
            "type""string"
        },
        "SMSUUIDChangeDate": {
            "type""string"
        },
        "SNMPCommunityName": {},
        "SuppressAutoProvision": {},
        "SystemContainerName": {
            "type""array"
        },
        "SystemGroupName": {
            "type""array"
        },
        "SystemOUName": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "SystemRoles": {
            "type""array",
            "items": {
                "type""string"
            }
        },
        "Unknown": {},
        "UserAccountControl": {
            "type""integer"
        },
        "VirtualMachineHostName": {
            "type""string"
        },
        "VirtualMachineType": {
            "type""integer"
        },
        "WipeStatus": {},
        "WTGUniqueKey": {}
    }
}
 
Thanks in advance for any assistance w/this!
1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

Actually, based on the schema its returning an array of objects.  So you should definitely store them in a collection.  Your collection in Power Apps would be a collection of objects.  YOu would have to drill down in the objects to get at the properties.  Make sure the schema matches the data you are actually sending back.  I would also remove the empty array under required.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
Pstork1
Dual Super User III
Dual Super User III

In your question you say you are trying to store this in a collection.  But the schema says you are returning an object.  To store it in a collection you need to return an array, not an object with embedded arrays.  You need to parse the json a bit more to return an array rather than an object.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
russrimm
Microsoft
Microsoft

Well it's a bit confusing, because if I use a parse json and pick "Name" it wraps it in an apply to each, so it thinks Name is an array.   I want to return all of the "properties" but they're all being treated as an array type even though many of them aren't.  I think it's not generating the correct schema from my sample?

Pstork1
Dual Super User III
Dual Super User III

Value is the array property in your output that includes Name.  So the From of your Response object should be just the Value property, not the entire Body.  Your Schema should be generated just from the JSON inside Value also.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

So i've gotten more selective in my http query and i'm using this schema now, but i'm wondering how best to return the data back to powerapps.  If I try to populate a collection or variable it's empty.  I'm using the value now, but I suppose it's because it's an object not an array that's being returned. 

{
    "type""array",
    "items": {
        "type""object",
        "properties": {
            "BuildExt": {
                "type""string"
            },
            "Client": {
                "type""integer"
            },
            "ClientVersion": {
                "type""string"
            },
            "CreationDate": {
                "type""string"
            },
            "DistinguishedName": {
                "type""string"
            },
            "FullDomainName": {
                "type""string"
            },
            "IPAddresses": {
                "type""array",
                "items": {
                    "type""string"
                }
            },
            "Name": {
                "type""string"
            },
            "SMSAssignedSites": {
                "type""array",
                "items": {
                    "type""string"
                }
            }
        },
        "required": [
        ]
    }
}
Pstork1
Dual Super User III
Dual Super User III

Actually, based on the schema its returning an array of objects.  So you should definitely store them in a collection.  Your collection in Power Apps would be a collection of objects.  YOu would have to drill down in the objects to get at the properties.  Make sure the schema matches the data you are actually sending back.  I would also remove the empty array under required.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (59,404)