cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Missing Properties in Collection when calling custom REST API Connector

Hi everyone,
 
I'm quite new to working with custom connectors and stumbled upon something could need a bit of assistance with 🙂
 
I created a custom connector for azure lab services from an openapi definition which I want to use inside a PowerApp. The connector Seems to be working fine. However, when calling it from inside my app, the collection does not seem to contain all properties. 
 
Here is what I get when running the test from the connector: (x'ed out some values)
{
  "value": [
    {
      "properties": {
        "maxUsersInLab"1,
        "userQuota"400,
        "invitationCode""xxx",
        "createdByObjectId""xxx",
        "usageQuota""PT10H",
        "userAccessMode""Restricted",
        "createdByUserPrincipalName""xxx",
        "createdDate""xxx",
        "provisioningState""Succeeded",
        "uniqueIdentifier""xxx",
        "latestOperationResult": {}
      },
      "id""xxx",
      "name""xxx",
      "type""Microsoft.LabServices/labAccounts/labs",
      "location""xxx"
    }
  ]
}
 

When using the same call from inside the app, the resulting collection only contains the "properties" object, but is missing id, name, type and location

2020-04-22 11_48_30-Window.png

2020-04-22 11_56_20-Window.png

2020-04-22 11_57_22-Window.png

 
Any Idea on why the properties are missing in the collection? Is there a way to inspect the results outside of a collection?
 
Thanks & Regards
Fabian
5 REPLIES 5
Highlighted
Community Support
Community Support

Re: Missing Properties in Collection when calling custom REST API Connector

Hi @ffcloud-bskies ,

Could you please share a bit more about the Response JSON Schema you defined for this action within your custom connector?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. Please make sure you have defined proper Response JSON Schema for this action within your custom connector:

2.JPG

 

Then you could edit these properties under the Response Body, please make sure you do not set Visibility property of the id, name, type and location property to "internal", instead, you could set the Visibility property of these missed properties to "important":

4.JPG

 

If the issue still exists, please consider create a new custom connector from scratch based on your REST API. Then specify proper action within this custom connector, and define proper Response JSON Schema for this action, then check if the issue is fixed.

 

More details about creating custom connector in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/register-custom-api

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Missing Properties in Collection when calling custom REST API Connector

Hi @v-xida-msft,

Thank you very much for your reply. This helped a lot. 

 

I basically need a connector for Azure Lab Services. So as I didn't find an existing connector supporting Lab Services, I took the API definition from GitHub (https://github.com/Azure/azure-rest-api-specs/tree/master/specification/labservices/resource-manager...) and used it to create a custom connector.

 

What I found out is, that "Lab" definition amongst some others references "Resource" definition, which defines the properties I'm missing in the resulting PowerApps collection when executing the query.

2020-04-23 13_46_46-Swagger Editor and 57 more pages - 2 Bright Skies - Microsoft​ Edge.png

This seems not being resolved by PowerApps. Replacing the reference with the actual properties from Resource definition solved the issue.

So for now I will get it to work as intended, hence modifying the schema and replacing nested references that cannot be resolved.

Do you know if this is known and might be changed in the future? In general it seems to be a supported scenario in OpenAPI (swagger seems to successfully resolve all references)

 

Thanks & Regards

Fabian

 

Highlighted
Community Support
Community Support

Re: Missing Properties in Collection when calling custom REST API Connector

Hi @ffcloud-bskies ,

Do you want to define the Response Body within your custom connector OpenAPI definition file via $ref?

 

Based on what I have known, I think you could define reference for the specific action in your OpenAPI definition file via $ref key.  But based on the "Lab" definition structure that you mentioned, I think there is something wrong with it.

 

If you want to defined a Response Body for a specific action in your custom connector via $ref key, the standard OpenAPI definition structure should be as below:

responses:
        200:
          description: A User object
          schema:
            $ref: '#/definitions/User'
definitions:
  User:
    type: object
    properties:
      id:
        type: integer
        description: The user ID.
      username:
        type: string
        description: The user name.

You should specify the Schema inline the Operation, and then use $ref key to reference the Response definition. Please check the following article for more details:

https://swagger.io/docs/specification/2-0/describing-responses/

 

Please make sure you have defined proper Schema keyword to describe Response Body for your operation. As an fixed solution, I agree with your solution, you could replace the reference with the actual properties from Resource definition.

 

In addition, you could also consider take a try to create your custom connector from scratch based on your REST API, then you could get rid of this OpenAPI definition structure issue.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Missing Properties in Collection when calling custom REST API Connector

Hi @v-xida-msft ,

 

the definition I'm using is not describing a custom API I created. It is describing the Microsoft Azure API for working with Azure Lab Services and is being maintained by Microsoft. That of course doesn't mean, that it must be fitting the specification, but

as Azure APIs are quite extensive, creating the connector from scratch would be very time consuming and also a bit unreliable compared to just taking the published definition (that has probably been generated from the actual API) and using it here. I would also like to avoid doing bigger changes to make it fit to PowerApps.

I had a look at the OpenAPI spec and found, that the constellation used for referencing the Resources schema seems to be valid as per https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ so from what I see there, there is nothing wrong with the definition I used.

 

As mentioned above, for now I have a workaround. But it would be a very nice thing just being able to take definitions from the Microsoft Azure Repos and directly create connectors from it. That would save a lot of time. Or even better, just having a Built-In connector for all of the Azure APIs 🙂

 

Regards

Fabian

 

Edit: If it turns out, that there is something wrong with the definition, I will head over to GitHub and ask for a fix. But from what I found out until now, that doesn't seem to be the case.

Highlighted
Microsoft
Microsoft

Re: Missing Properties in Collection when calling custom REST API Connector

Same problem on my side with the allOf operator.

Seems PowerApps does not support this part of the OpenApi V2 spec.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,880)