cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thecolonel
New Member

Returning JSON Array to Power Apps

I am new to the power platform however I have managed to perform an get API call via Automates "HTTP" step.

I have a Http response from this as follows:

 

 

 

[
  {
    "id": 793272,
    "summary": "Create Network map",
    "recordType": "ServiceTicket",
    "board": {
      "id": 1,
      "name": "Service Desk"
    },
    "status": {
      "id": 591,
      "name": "Assigned Unscheduled"
    }
  },
{
    "id": 793273,
    "summary": "Create Network map2",
    "recordType": "ServiceTicket",
    "board": {
      "id": 1,
      "name": "Service Desk"
    },
    "status": {
      "id": 591,
      "name": "Assigned Unscheduled"
    }
  }
]

 

 

 

 So far so good. If I wanted to return this data (or at the very least id, summary and recordtype) to a canvas app and use it to populate a collection with columns. How do I do this?

 

Currently I have a "Respond to Powerapp or flow" step that returns and escaped Json string ie: 

 

 

 

"output": "[{\"id\":793272,\"summary\":\"Create Network map\"...

 

 

 

 The call to automate in Powerapps is constructed as follows: 

 

 

 

Set(id,"20960");
Collect(Collection1, GetCWTickets.Run(id))

 

 

 

The collection is returned as a single value and single row. How do I change this to display the id,summary and recordtype as columns? 

 

Collection ContentsCollection Contents

2 ACCEPTED SOLUTIONS

Accepted Solutions
annajhaveri
Super User
Super User

@thecolonel  use Response action to return the json back to PowerApps. Use following expression in PowerApps to store the json in collection

ClearCollect(Collection1, GetCWTickets.Run(id))
Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

v-bofeng-msft
Community Support
Community Support

Hi @thecolonel :

Agree with @annajhaveri ,please use the 'Response' action instead of "Respond to Power app or flow".I've made a test for your reference:

vbofengmsft_0-1631670681262.png

Response Body JSON Schema:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "id": {
                "type": "integer"
            },
            "summary": {
                "type": "string"
            },
            "recordType": {
                "type": "string"
            },
            "board": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    }
                }
            },
            "status": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    }
                }
            }
        },
        "required": [
            "id",
            "summary",
            "recordType",
            "board",
            "status"
        ]
    }
}

The Result:

vbofengmsft_1-1631670707166.png

Best Regards,
Bof

 

 

 

View solution in original post

2 REPLIES 2
annajhaveri
Super User
Super User

@thecolonel  use Response action to return the json back to PowerApps. Use following expression in PowerApps to store the json in collection

ClearCollect(Collection1, GetCWTickets.Run(id))
Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

v-bofeng-msft
Community Support
Community Support

Hi @thecolonel :

Agree with @annajhaveri ,please use the 'Response' action instead of "Respond to Power app or flow".I've made a test for your reference:

vbofengmsft_0-1631670681262.png

Response Body JSON Schema:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "id": {
                "type": "integer"
            },
            "summary": {
                "type": "string"
            },
            "recordType": {
                "type": "string"
            },
            "board": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    }
                }
            },
            "status": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    }
                }
            }
        },
        "required": [
            "id",
            "summary",
            "recordType",
            "board",
            "status"
        ]
    }
}

The Result:

vbofengmsft_1-1631670707166.png

Best Regards,
Bof

 

 

 

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,277)