In the context of preparing for the PL-500 Microsoft Power Platform Developer exam, you should be familiar with the steps related to coding, authenticating and testing the custom connectors.
Writing Code in a Custom Connector
A Custom Connector is essentially a wrapper around a RESTful API that allows Power Automate, Power Apps, and Azure Logic Apps to communicate with that API. To create and code a custom connector, you’ll need to perform the following steps:
- Create an API Definition: Custom Connectors uses OpenAPI v3 by default, but you can use Postman collections or other descriptions as a starting point. You might need to define the API operations, URL, operation ID, parameters, and response structures.
- Set up the General Connector Information: This would include defining the scheme (HTTPS), host (API URL), and base URL path.
- Define the API endpoints: You would have to define operation ID, request method, and the summary and description of the operation.
- Define the Request: This includes path, query, and header parameters. You might need to define the type, description, and default value of these parameters.
- Define the Response: You would have to define the response structure, along with the type of each response data.
- Define the Connector’s Authentication Type: Power Automate custom connectors support various authentication types, including No Authentication, API Key, Basic Authentication, and OAuth 2.0. Your choice would depend on the requirements of the API you’re wrapping.
Scheme: "HTTPS"
Host: "api.example.com"
Base URL path: "/v1"
Operation ID: "getContact"
Request Method: "GET"
Operation Summary: "Retrieve Contact"
Description: "Retrieves contact details for a specific ID"
Path Parameters: [
{name: "contactId", in: "path", required: true, type: "integer", description: "The ID of the contact to retrieve"}
]
Response(200): {
description: "Successful Operation",
schema: {
type: "object",
properties: {
id: {type: "integer"},
name: {type: "string"},
email: {type: "string"},
phone: {type: "string"},
}
}
}
The code snippet above provides an overview of how the process of creating a custom connector might look like. We’re establishing a connection to an API and defining a GET operation to retrieve contact details based on a provided ID.
Testing the Custom Connector
After the custom has been designed, it’s time to test it out. You can do this in the Power Automate portal by clicking on the ‘Test’ tab in your custom connector creation experience. Here, establish a connection and select the operation you wish to test. After inputting any required parameters and clicking ‘Test operation’, you should receive the API’s response which indicates your custom connector is working as expected.
Finally, remember that creating a custom connector is a process that necessitates a good grasp of not only the Power Automate features but also the specifics of the API you’re wrapping.
Understanding and effectively applying these principles is a crucial part of preparing for the PL-500 Microsoft Power Platform Developer exam. Getting hands-on experience with creating and testing custom connectors will significantly enhance your understanding and mastery of the subject.
Practice Test
True or False: A custom connector allows you to connect any web service that has API capabilities with Power Automate.
- Answer: True
Explanation: Custom connectors are designed to connect any public APIs or any web-based service to Power Automate, thus expanding its functionality.
How can you test a custom connector in Power Automate after its creation?
- a) You cannot test a custom connector.
- b) By using the “Test” tab in the custom connector wizard.
- c) By using it in a Power Automate flow immediately.
- d) By writing a separate code for testing.
Answer: b) By using the “Test” tab in the custom connector wizard.
Explanation: After creating a custom connector, you can easily test it from the “Test” tab in the custom connector wizard within the Power Automate interface.
True or False: A custom connector requires a specification document and a Postman collection.
- Answer: False
Explanation: While a specification document and a Postman collection can be helpful for creating a custom connector, they are not mandatory. Power Automate provides several ways to create a custom connector.
What types of actions can be defined in custom connectors for Power Automate?
- a) REST actions only
- b) SOAP actions only
- c) Both REST and SOAP actions
- d) Neither REST nor SOAP actions
Answer: c) Both REST and SOAP actions
Explanation: Power Automate supports both REST and SOAP actions, enlarging the potential application base of custom connectors.
True or False: Custom connectors can include triggers.
- Answer: True
Explanation: In addition to actions, custom connectors can also include triggers, which can initiate flows in response to certain events.
What authentication types are supported for custom connectors in Power Automate?
- a) No authentication
- b) API Key
- c) OAuth 0
- d) Both b) and c)
Answer: d) Both b) and c)
Explanation: Custom connectors in Power Automate can be authenticated using either an API key or OAuth
True or False: Custom connectors cannot be used across multiple flows.
- Answer: False
Explanation: Once a custom connector is created, it can be used in multiple flows and even across different Power Automate environments.
In Power Automate, are custom connectors always classified as premium connectors?
- a) Yes
- b) No
Answer: b) No
Explanation: The classification of custom connectors as standard or premium depends on the type of base service or API they connect with.
True or False: All users in your organization can use your custom connectors if you choose to share them.
- Answer: True
Explanation: Power Automate allows you to share your custom connectors with other users in your organization, who can then use those connectors in their own flows.
What is a prerequisite for defining a trigger in a custom connector?
- a) It must be a REST action.
- b) It must be a SOAP action.
- c) It must support webhooks.
- d) There is no prerequisite for defining a trigger.
Answer: c) It must support webhooks.
Explanation: To define a trigger in a custom connector, the API must support webhooks to send real-time data to Power Automate.
Interview Questions
How can you describe a Custom Connector from a developer’s perspective?
A Custom Connector is a developer-accessible wrapper around a RESTful API that enables Power Automate to use the API.
What are the main components of a Custom Connector?
The primary components are the Base URLs, Actions and Action parameters, and Responses.
How do you define a Base URL during the creation of a Custom Connector?
A Base URL is the primary endpoint for your API service. It often includes the domain name and path transferring to your service.
What is an Action in the context of writing code in a Custom Connector?
An Action in a custom connector is the functionality that the connector exposes. It determines what operations the connector can perform, for instance, retrieving data from an API or posting a message.
What is the significance of Action Parameters while creating a Custom Connector?
Action parameters define the input fields that are required to execute the action in a Custom Connector. They inform Power Automate what information it needs to collect from the user.
How are responses defined in the context of Custom Connectors?
Responses can be defined by using a payload representing what the service might return back after an operation. This allows Power Automate to understand the structure of the data coming back from the connector.
How can you specify authentication in a Custom Connector?
You can specify authentication in a Custom Connector by choosing from four Authentication types: No Authentication/ Anonymous, Basic Authentication, OAuth 2.0, API Key.
What are the steps to import an OpenAPI definition to configuration a Custom Connector?
Go to Data -> Custom Connectors -> Create custom connector -> Import an OpenAPI file. Here, you can choose your OpenAPI file and import it.
How would one use a Custom Connector within Power Automate Flow?
After developing the Custom Connector and incorporating the API definitions, it would show up in the list of available actions and triggers when building a Flow.
When should you create a Custom Connector?
If the service you want to connect to isn’t already available as a Microsoft-provided connector, and the service provides a RESTful API, then you should create a custom connector.
What protocol is often needed when you develop a Custom Connector?
The HTTP or HTTPS protocols are needed when developing a custom connector, as custom connectors use RESTful APIs.
Can you name some of the methods that are supported by the Custom Connectors?
Custom Connectors support methods like GET, POST, PATCH, DELETE, and PUT.
How do updates made to a Custom Connector affect the Flows using it?
Any changes made to the Custom Connector will be reflected in the Flows using it once refresh operation is performed.
How to test the Custom Connector within Power Automate?
You can test a Custom Connector within Power Automate by going to the Test tab in your connector’s setup page, and then filling out the fields that your connector requires and selecting “Test operation”.
How do you share the Custom Connector with other users in Power Automate?
Custom Connectors are shared the same way as other resources in Power Automate. You must have the approver or environment maker role in order to share connectors.