cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kamil-k
Level: Power Up

Custom API : Incompatible Records

Hi, 

I´ve included a custom API to my PowerApp, this works fine - I think....

 

The Swagger look´s like this: 

{
    "swagger": "2.0",
    "info": {
        "version": "v1",
        "title": "Test Web Api"
    },
    "host": "test.webapi.com",
    "schemes": [
        "https"
    ],
    "paths": {
        "/api/Vu": {
            "get": {
                "tags": [
                    "Vu"
                ],
                "operationId": "GetVu",
                "consumes": [],
                "produces": [
                    "application/json",
                    "text/json"
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/VU"
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Vu"
                ],
                "operationId": "Vu_Post",
                "consumes": [
                    "application/json",
                    "text/json",
                    "application/x-www-form-urlencoded"
                ],
                "produces": [
                    "application/json",
                    "text/json"
                ],
                "parameters": [
                    {
                        "name": "item",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/VU"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/Vu/{id}": {
            "get": {
                "tags": [
                    "Vu"
                ],
                "operationId": "GetVuById",
                "consumes": [],
                "produces": [
                    "application/json",
                    "text/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "integer",
                        "format": "int32"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/VU"
                        }
                    }
                }
            },
            "put": {
                "tags": [
                    "Vu"
                ],
                "operationId": "Vu_Put",
                "consumes": [
                    "application/json",
                    "text/json",
                    "application/x-www-form-urlencoded"
                ],
                "produces": [
                    "application/json",
                    "text/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "integer",
                        "format": "int32"
                    },
                    {
                        "name": "item",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/VU"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Vu"
                ],
                "operationId": "Vu_Delete",
                "consumes": [],
                "produces": [
                    "application/json",
                    "text/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "integer",
                        "format": "int32"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "VU": {
            "type": "object",
            "properties": {
                "VUDescription": {
                    "type": "string"
                },
                "Location": {
                    "type": "string"
                },
                "Id": {
                    "format": "int32",
                    "type": "integer"
                },
                "Name": {
                    "type": "string"
                },
                "CreatedDate": {
                    "format": "date-time",
                    "type": "string"
                },
                "ModifiedDate": {
                    "format": "date-time",
                    "type": "string"
                },
                "CreatedBy": {
                    "type": "string"
                },
                "ModifiedBy": {
                    "type": "string"
                },
                "Version": {
                    "format": "byte",
                    "type": "string"
                }
            }
        }
    }
}

and the Get-Method from the API is returning following JSON:

[
  {
    "VUDescription": "TEst Item in DB",
    "Location": "Everywhere",
    "Id": 1,
    "Name": null,
    "CreatedDate": "2016-09-14T09:18:40.693",
    "ModifiedDate": null,
    "CreatedBy": "testuser@domain.com",
    "ModifiedBy": "testuser@domain.com",
    "Version": "AAAAAAAAB9M="
  }
]

Then I declared a ListBox in my PowerApp and set the Items Property of it to : MyApi.VuGet() but it then gets instantly red squiggles and says: The Property is awaiting Table-Values but got incompatible record values.

So, I just changed the Item Property of the Listbox to : Table(MyApi.VuGet()) but it the gets blue squiggles and says something like: Warning: The columns created by this rule are nested tables or datasets.... I know the API fetches some data because there is one blank item inside of the listbox , but I don´t know how to access any of the properties because the Auto-Completion feature isnt´t working also.

Do anyone of you have an advice? 

 

Thanks in advance,

Kamil

6 REPLIES 6
Community Support Team
Community Support Team

Re: Custom API : Incompatible Records

Hi Kamil-k,

 

Apologize that currently I don't have any custom API to test with.

Just from the error message, I could think of the following ways, which you may give it a try:

1. Under the item property of the listbox, add a dot at the end of MyApi.VuGet(), see if it would have any attributes listed, if yes, choose one which has no blank value;

2. Take use of Collect function to collect the data from your API, then use the Collection with the listbox.

Collect, clear and clearcollet functions in PowerApps

Hope the information above would be helpful.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
kamil-k
Level: Power Up

Re: Custom API : Incompatible Records

Hi,

unfortunately it doesn´t help.

Meneghino
Level 10

Re: Custom API : Incompatible Records

Hi @kamil-k, have you tried using the Ungroup function to open your nested records?

In any case what I would do is to ClearCollect(TempCollection, Table(MyApi.VuGet())) and then inspect the contents of TempCollectoin directly via the content tab of PowerApps Studio so you can see what structure the data has been returned with. You can see the column names as well as click through to any nested records/tables.

Please let me know if this helps.

 

 

Meneghino
Level 10

Re: Custom API : Incompatible Records

PS Out of curiosity I tried the API and I seem to get the correct data structure into my TestCollection in PowerApps, please see screenshot below.

However I get a server error in PowerApps, so there is no data, and Swagger Editor also gives me an error.

 

VuCapture.JPG

kamil-k
Level: Power Up

Re: Custom API : Incompatible Records

Looks promising,  I will try it ASAP

joshbooker
Level 8

Re: Custom API : Incompatible Records

Custom APIs do not presently have what PowerApps considers 'tabular' capabilities.  If you want this please up-vote here:

 

https://powerusers.microsoft.com/t5/PowerApps-Ideas/Custom-API-with-tabular-capabilities/idc-p/22385

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,242)