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
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
Hi,
unfortunately it doesn´t help.
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.
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.
Looks promising, I will try it ASAP
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
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
200 | |
179 | |
67 | |
36 | |
33 |
User | Count |
---|---|
341 | |
271 | |
113 | |
73 | |
58 |