cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wkaper1
Regular Visitor

Bug? Simple CRUD API: strange function signature using PUT function

I have a custom API that does GET, POST, PUT and DELETE actions on a single type of items.
This question / bug report is about the PUT function.
I registered the custom connector and it shows the PUT function correctly as in the below screenshot.

 

Connector_Definition_Put.PNG

As the screenshot shows there are two parameters:
- id
- A record that contains four properties: Title, ToDoID, Priority, Done

If I try to use this function inside PowerApps, it shows me a different signature, as the next three pictures will show.

 

ToDoes_PUT_param1_of_3.PNG

 

PowerApp shows it expects two parameters, called "id" and "Title".
After I add the requested Title as in screenshot 3, it becomes clear that a third parameter is expected which is a record.

 

ToDoes_PUT_param3_of_3_initial.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Screenshot 3: a Record is expected as a third parameter:
The expected contents of the record are shown between the curly braces, as below:
{ ToDoID: number, Priority: number, Done: Boolean }

My question: why is the "Title" property not inside the curly braces?
That would be consistent with the design of the API as well as consistent with the connectors view of the API.
Can I call it a bug?

This PowerApp works though !
I can update the "Title", if I complete the formula as below (screenshot 4).

 

ToDoes_PUT_param3_of_3_final.PNG

 

If you want to reproduce the "problem", see the details below:

The API is here:
http://entocaretodoapi.azurewebsites.net/
It's public at the moment.

It's swagger file is at:
http://entocaretodoapi.azurewebsites.net/swagger/docs/v1

With best regards,
wkaper1

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @wkaper1,

 

I don't think this is a bug, it seems this is related with the Todo definition:

  "definitions": {
    "ToDo": {
      "required": [ "Title" ],
      "type": "object",
      "properties": {
        "ToDoID": {
          "format": "int32",
          "type": "integer"
        },
        "Priority": {
          "format": "int32",
          "type": "integer"
        },
        "Title": {
          "maxLength": 50,
          "minLength": 0,
          "type": "string"
        },
        "Done": { "type": "boolean" }
      }
    }
  },

I assume if you remove the "Required " attribute, then the title field should be added into {} under the put method.

 

Regards,

Michael

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.

View solution in original post

4 REPLIES 4
v-micsh-msft
Community Support
Community Support

Hi @wkaper1,

 

I don't think this is a bug, it seems this is related with the Todo definition:

  "definitions": {
    "ToDo": {
      "required": [ "Title" ],
      "type": "object",
      "properties": {
        "ToDoID": {
          "format": "int32",
          "type": "integer"
        },
        "Priority": {
          "format": "int32",
          "type": "integer"
        },
        "Title": {
          "maxLength": 50,
          "minLength": 0,
          "type": "string"
        },
        "Done": { "type": "boolean" }
      }
    }
  },

I assume if you remove the "Required " attribute, then the title field should be added into {} under the put method.

 

Regards,

Michael

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.

Hi @v-micsh-msft,

Thanks for your suggestion. I removed the "required" attribute from the ToDo definition as you suggested. Then re-uploaded the file to PowerApps custom connectors. I clicked "update connector".

Then I opened the PowerApp that uses the API and inspected the formula. It still works and does not show me an error. It is still satisfied getting 3 parameters: first the id, then the Title, then a Record that has just three properties (all four, minus Title).

 

Does the PowerApp still use the old definition of the connector? What should I do to refresh it?

Under the available connections list, delete the old connection of the custom connector, then add a new one.

In PowerApps, under the Add Data Source side, delete the old connection, then click add a new data source, add the corresponding connection there, or you may create a new connection from the Add data source side.

See if this helps.

https://powerapps.microsoft.com/en-us/tutorials/add-data-connection/

 

Regards,

Michael

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.

The custom connector was already in the right shape.

I opened the PowerApp, deleted the old connection, then added it again.

Indeed it helps!

I see the REST API formula now as expected:

      ToDoAPI.ToDoesPut( id, { ...} )

 

Just an id and a Record as parameters.

And the Title is now part of the Record.

I still do not understand why he did it differently at first, but I guess I need to study the swagger manuals some more!

 

Thank you for you help!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,471)