0

We have a .NET web application and it has REST API. Where each of our customers has their own API key. Now we want to create a Power Apps custom connector, which allow our users to easily create items inside our system through the API. So I will create the custom connector >> define the POST request, where users will have to submit this JSON data:-

{
  "id": 0,
  "name": "string",
  "email": "string",
  "phone": "string",
  "trusted": true,
  "paymentDetails": [
    {
      "id": 0,
      "currency": "string",
      "sortCode": "string",
      "accountNumber": "string",

      "address": {
        "id": 0,
        "addressLine1": "string",
        "addressLine2": "string",
        "mainAddress": true,
        "type": "BENEFICIARY"
      }
    }
  ],
  "externalId": "string",
  "taxResidency": "string"
}

but what i am not sure about is how users will be consuming this API inside their Power Apps? For example when we use the build-in SharePoint connector, we can do the following inside our Apps:-

  1. Add a form 

  2. Define the source for the form to be a SharePoint list

  3. Then Power Apps will automatically add the fields inside the Forms

  4. Then we can simply submit the data back to SharePoint by writing "SubmitForm(FormA)"...

So i have these three questions:-

  1. When we create the custom connector and define the above JSON object >> will we get the same capabilities as in the SharePoint Connector? so we can add a form inside a Power Apps>> define its source to be our connector >> get all our fields automatically added inside the form >> submit the data to the API by calling SubmitForm(****)? or things will be more manual, where we will have to define the form fields by ourselves and manually reference those fields to be submitted to the API?

  2. Most of the documentations and videos i found about creating custom connectors, use GET methods. Where they pass parameters to the API through the custom connector and get the feedback.. but i could not find any documentation about how to create POST requests inside custom connectors, and then use this Post action to build a Form and submit the form data to the API through the custom connector?

  3. Since our JSON have nested properties such as PaymentDetails & PaymentDetails.Address.. so are those types of JSON supported when creating custom connectors? If so then how those JSON properties will be represented inside the Power Apps form fields? in other words, if we want to define the PaymentDetails.Address.Address1 field inside the form then what will be the field name?

Thanks in advance for any help.

Regards 

John John
  • 1
  • 72
  • 238
  • 501

1 Answers1

1

Question 1: Yes. The connector that's built in the back-end is the same for both applications. Basically it looks at the swagger that's created from your custom connector and those have the same responses.

Question 2: When you define an action as POST, you get a response back. That response can be linked to your form, so it's filled with the data that's being returned. So again, it's possible.

Question 3: You named the route PaymentDetails.Address.Address1, so the reference will be PaymentDetails.Address.Address1, but the name of the field can be renamed to anything you want.

Iona Varga
  • 509
  • 2
  • 8
  • thanks for the reply. but sorry seems i did not get your answer very well. so for the Question-1, are you saying that we will get the exact experience when using custom connector and when using the built-in SharePoint connector? in respect to having our form created with all the related fields by just specifying the source for the form to be the custom connector, and then submitting the data by executing SubmitForm(**)? – John John Feb 24 '22 at 11:51
  • For Question-2, i am asking about docs talking about creating Post request in custom connectors.. for Question-3, but if i rename the field to something else then how Power App will map the field to the correct property in the API. am i missing your answer? – John John Feb 24 '22 at 11:51
  • 1
    A form is basically a collection of input parameters, linked to a reference field. Once you use SubmitForm, the api that is behind this uses POST calls to get the data to the desired datasource. You probably don't want to use SubmitForm but rather use your custom connector's action i.e. YourCustomConnectorName.CreateRecord( Your params ). I answered creating post requests, you define a request as.... POST. (Magic, I know) Your custom connector/API router defines the route to whatever it needs to route to. You just give input from powerapps whether it is from FieldA or FieldB. – Iona Varga Feb 24 '22 at 11:56
  • so now in the SharePoint built-in case we define the source of the form to be a SharePoint list >> then simply use the SubmitForm and the data will be sent to SharePoint.. we do not have to manually pass the parameters.. so can you explain why i need to use this syntax `YourCustomConnectorName.CreateRecord( Your params )` ?as you can see we have around 20 JSON properties, so so we need to manually reference them inside the params? this is my main concern.. – John John Feb 24 '22 at 12:00
  • for question-2 i meant to say where i can find relevant docs and videos which mimic what i am planning to do? Which are; create custom connector >> define Post action inside it >> use the custom connector as the source for a form >> and submit the form data to the custom connector... – John John Feb 24 '22 at 12:02
  • 1
    https://learn.microsoft.com/en-us/connectors/custom-connectors/define-blank perfectly explains your custom connector. For everything else, Google is your friend ;-) Way too much documents about it. Try to connect the lines when reading. – Iona Varga Feb 24 '22 at 12:37
  • ok thanks for the link,, but can you advice on question-1? – John John Feb 24 '22 at 15:20
  • i am not sure why you are so mean in providing info,, i posted 3 clear questions.. but did not get any help on any of them.. especially on question-1 – John John Feb 24 '22 at 15:28