To begin with, Dataverse is Microsoft’s intelligent and secure platform for businesses to create, secure, share, and analyze data. One of its new capabilities is the introduction of Custom API, a type of custom action that allows developers to define their API in Dataverse and use it like other APIs in the platform. Configuring a Custom API involves a few necessary steps involving defining the API, its request parameters, and its response properties.

Table of Contents

Defining your Custom API

The first step is to define your Custom API. This involves some mandatory and some optional values to be set.

Below is an example of how to create a Custom API:

var customApi = new Entity(“customapi”);
customApi[“uniquename”] = “new_TestAPI”;
customApi[“name”] = “Test API”;
customApi[“description”] = “This API is used for testing”;
customApi[“isfunction”] = false;
customApi[“isprivate”] = false;
customApi[“boundentitylogicalname”] = “account”;
customApi[“pluginassemblyid”] = new EntityReference(“pluginassembly”, pluginAssemblyId);
customApi[“plugintypeid”] = new EntityReference(“plugintype”, pluginTypeid);
//Don’t display in API list
customApi[“displayinsdkmessageprocessingsteps”] = false;

var createRequest = new CreateRequest();
createRequest.Target = customApi;

var createResponse = (CreateResponse)service.Execute(createRequest);

In the example above, we defined the unique name, the display name, description, whether it is a function or action, whether it is private, and the entity it is bound to.

Defining Request Parameters

Once you have your API defined, the next step is to define request parameters. Here is an example of how to define a request parameter:

var requestParameter = new Entity(“customapirequestparameter”);
requestParameter[“uniquename”] = “CustomRequest”;
requestParameter[“name”] = “Custom Request”;
requestParameter[“description”] = “Custom API Request Parameter”;
requestParameter[“parameterbindinginformation”] = “accountid”;
requestParameter[“name”] = “Custom Request Parameter”;
requestParameter[“solutionid”] = new EntityReference(“solution”, solutionid);
requestParameter[“customapiid”] = new EntityReference(“customapi”, customApiId);
requestParameter[“displayname”] = “Custom Request Display Name”;
requestParameter[“iscustomizable”] = new BooleanManagedProperty(false);

var createRequest = new CreateRequest();
createRequest.Target = requestParameter;

var createResponse = (CreateResponse)service.Execute(createRequest);

In this case, we defined the unique name, the display name, if it’s customizable, and binding information.

Defining Response Properties

Finally, you have to define response properties:

var responseProperty = new Entity(“customapiresponseproperty”);
responseProperty[“uniquename”] = “ResponseProperty”;
responseProperty[“name”] = “Response Property”;
responseProperty[“description”] = “Custom API Response Property”;
responseProperty[“customapiid”] = new EntityReference(“customapi”, customApiId);
responseProperty[“solutionid”] = new EntityReference(“solution”, solutionid);

var createRequest = new CreateRequest();
createRequest.Target = responseProperty;

var createResponse = (CreateResponse)service.Execute(createRequest);

In this example, we defined the unique name, the name, the solution it is part of, and the id of the custom API.

Understanding these steps in configuring a Dataverse Custom API should provide an excellent foundation to perform well in related questions on the PL-400 Microsoft Power Platform Developer exam. In your preparation, remember to put these steps into practice to gain practical understanding.

Practice Test

True or False: The Microsoft Power Platform provides a feature to configure a Dataverse Custom API message.

  • True
  • False

Answer: True

Explanation: Microsoft Power Platform provides developers with a feature to configure a Dataverse Custom API message to perform operations on the Common Data Service (CDS).

Multiple Select: What are the basic steps required to configure a Dataverse Custom API message?

  • A. Create a new Custom API record.
  • B. Design a new Custom Action.
  • C. Generate an Application User.
  • D. Register an Input and Output Parameter.
  • E. Configure an API Gateway.

Answer: A, D

Explanation: The basic steps to configure a Dataverse Custom API message are to create a new Custom API record and Register an Input and Output Parameter.

True or False: Plug-in Type field is optional while configuring Dataverse Custom API message.

  • True
  • False

Answer: False

Explanation: Plugin Type is a required field while configuring the Dataverse Custom API message. This field references the plugin type that’s associated with the Custom API.

Single Select: Why do we configure a Dataverse Custom API message?

  • A. To customize the user interface
  • B. To perform operations on the Common Data Service
  • C. To generate API documentation
  • D. To manage microservices

Answer: B

Explanation: We configure a Dataverse Custom API message to perform operations on the Common Data service (also known as Dataverse), such as create, read, update, or delete operations.

Multiple Select: What types of parameters can be used in Dataverse Custom API?

  • A. Body Parameter
  • B. Query Parameter
  • C. Entity Parameter
  • D. Header Parameter

Answer: A, B, D

Explanation: Body, Query, and Header parameters can be used in a Dataverse Custom API. Entity Parameter is not a valid type in Dataverse Custom API.

True or False: It is mandatory to register the plugin assembly before creating a new Custom API.

  • True
  • False

Answer: True

Explanation: It’s essential to register the plugin assembly before creating a new Custom API because the Plugin Type field on the Custom API record references the plugin type that’s associated with the Custom API.

Single Select: What do we mean by ‘Bound Entity Logical Name’ while configuring a Dataverse Custom API?

  • A. Name of the database
  • B. Name of the server
  • C. Logical name of the entity to which the API is bound
  • D. Name of the cloud platform

Answer: C

Explanation: ‘Bound Entity Logical Name’ refers to the logical name of the entity to which the API is bound in Dataverse.

True or False: You can use the Web API to perform operations with Dataverse Custom API messages.

  • True
  • False

Answer: True

Explanation: The Web API can indeed be used to perform operations with Dataverse Custom API messages.

Multiple Select: Which of the following methods or operations can be performed using Dataverse Custom API?

  • A. Create
  • B. Delete
  • C. Download
  • D. Update

Answer: A, B, D

Explanation: Create, Delete and Update are operations that can be performed using Dataverse Custom API.

Single Select: Can ‘Accessible Entity Types’ be modified after a Dataverse Custom API is created?

  • A. Yes
  • B. No

Answer: B

Explanation: ‘Accessible Entity Types’ is a read-only field and cannot be modified once a Dataverse Custom API is created.

Interview Questions

What is Dataverse Custom API in Microsoft Power Platform?

Dataverse Custom API is a powerful feature in Microsoft Power Platform that allows developers to create their own custom messages that can be used within plugins, workflows and form scripts. It is essentially a new code-first approach that is used to create your own APIs in a Dataverse database.

What are the essential components required to create a Dataverse Custom API?

The essential components required to Create a Dataverse Custom API are: the Custom API itself, Custom API Request Parameters, and Custom API Response Properties.

How can you set the privilege needed to use the custom API?

You can set the privilege needed to use the custom API by defining the ‘AllowedCustomProcessingStepType’ which indicates if a custom API can be called from particular modes such as synchronous, asynchronous, and internal.

Which primary entity can be related to a custom API in the Dataverse?

The ‘PrimaryEntityType’ can be related to a custom API in the Dataverse. It specifies which entity the API is primarily related to.

Can the ‘IsFunction’ property be modified after the custom API is created?

No, the ‘IsFunction’ property cannot be modified after the API is created. It is set when the API is defined and remains constant.

What role does the ‘BindingType’ property play in creating a custom API is the Dataverse?

The ‘BindingType’ property defines if and how a custom API is bound to an entity or entity collection.

What is the purpose of the ‘Description’ attribute in configuring a custom API in the Dataverse?

The ‘Description’ attribute is used to provide a brief explanation of what the custom API does. It’s a localized string that is useful in providing meaningful information about the API.

What is the significance of ‘AllowedCustomProcessingStepType’ in the custom API?

The ‘AllowedCustomProcessingStepType’ determines whether the custom API can be set as a “Step” of a workflow or not and if so, what type of step.

How do you indicate if a parameter is obligatory in a Dataverse custom API?

By using the ‘IsOptional’ attribute in the custom API request parameters, you can determine if a parameter is obligatory or optional.

Can the ‘UniqueName’ of a custom API be modified after the API is created?

No, the ‘UniqueName’ of a custom API cannot be modified after the API is created.

Why is the ‘Display Name’ important in creating a custom API?

The ‘Display Name’ is important as it provides a friendly name to be used within user interfaces for the custom API.

What does ‘IsPrivate’ mean when configuring a custom API?

When ‘IsPrivate’ is set to ‘Yes’, the custom API is only for internal use and cannot be called from outside the platform.

What is the purpose of ‘IsManaged’ property in a custom API?

The ‘IsManaged’ property indicates if the custom API is part of a managed solution. A managed solution is a completed package that is intended to be distributed and installed.

Leave a Reply

Your email address will not be published. Required fields are marked *