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
Highlighted
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
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,548)