Skip to main content

Action Configuration

Actions define the operations available for each entity. API Builder supports seven action types:

Action TypeHTTP MethodDescription
CreatePOSTCreate new records
UpdatePUTModify existing records
ReadGETRetrieve a single record by ID
DeleteDELETERemove records
UploadPOSTUpload files/attachments
DownloadGETDownload files/attachments
ProcessPOSTExecute custom actions
Route structure

Each action's route is /{module}/{entity-logical-name}/{endpoint-name} (create/process) or /{module}/{entity-logical-name}/{id}/{endpoint-name} (read/update/delete/upload/download), lowercased. There is no built-in /api/ prefix — any prefix comes from how you host the app. See Entities → Generated API Endpoints.

Common Action Components

All actions share these configuration components:

Definition

PropertyRequiredDescription
Endpoint NameYesThe URL path segment for this action

Documentation

PropertyRequiredDescription
TitleYesShort, descriptive name for the action
DescriptionNoDetailed explanation of what the action does

Inputs

Inputs define the parameters accepted by the API endpoint.

PropertyDescription
NameParameter identifier
TypeData type (String, Integer, Money, DateTime, Entity Reference, etc.)
RequiredWhether the parameter must be provided
Default ValueValue used if parameter is not provided
ValidationValidation rules (min/max, pattern, etc.)
DescriptionDocumentation for API consumers

Data Fetcher

The Data Fetcher allows you to execute queries before the main action. This is useful when the action depends on data that must be retrieved first.

PropertyDescription
Query NameIdentifier for referencing the fetched data
Query DefinitionThe query to execute (can reference inputs)
Result VariableVariable name to store the query result

Use Cases for Data Fetcher:

  • Validate that a referenced record exists
  • Retrieve default values from a related record
  • Check business rules against existing data
  • Fetch configuration values needed for the action

Access Control

See Access Control for complete details on Authorization Policy and Pre-conditions.


Create Action

The Create Action exposes an endpoint for creating new records of the entity.

Create Action Structure

┌──────────────────────────────────────────────────────────────────────┐
│ CREATE ACTION STRUCTURE │
├──────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ DEFINITION │ │
│ │ • Endpoint Name (URL path) │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ DOCUMENTATION │ │
│ │ • Title │ │
│ │ • Description │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ INPUTS │ │
│ │ • Input parameters from API request │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ DATA FETCHER │ │
│ │ • Pre-fetch queries for dependent data │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ ACCESS CONTROL │ │
│ │ • Authorization Policy │ │
│ │ • Pre-conditions │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ ENTITY PROPERTIES │ │
│ │ • Field bindings with inputs │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────┘

Entity Properties

Entity Properties define how inputs map to the Dataverse entity fields when creating the record.

PropertyDescription
Entity FieldThe Dataverse field name
BindingThe input parameter, fetched data, or expression to use
TransformOptional transformation applied before saving

API Request Example

POST /sales/account/create
Content-Type: application/json
Authorization: Bearer {token}

{
"name": "Contoso Ltd",
"email": "info@contoso.com",
"phone": "+1-555-0100",
"categoryCode": 1,
"primaryContact": "contact-guid-here",
"creditLimit": 50000.00
}

API Response

Success (200 OK):

{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Update Action

The Update Action exposes an HTTP PUT endpoint for modifying an existing record. The record id is taken from the route, and the supplied fields are written to the Dataverse record according to the action's entity-property bindings.

Update Action Features

  • HTTP PUT: The update action is emitted as a PUT endpoint (PATCH is not generated)
  • Field bindings: Only the fields mapped in Entity Properties are written
  • Data Validation: Pre-conditions can validate business rules before updates
  • Audit Trail: Changes can be tracked through Dataverse audit

API Request Example

PUT /sales/account/a1b2c3d4-e5f6-7890-abcd-ef1234567890/update
Content-Type: application/json
Authorization: Bearer {token}

{
"name": "Contoso Corporation",
"email": "info@contoso.com",
"phone": "+1-555-0200",
"creditLimit": 75000.00
}

API Response

Success (200 OK):

HTTP/1.1 200 OK
Content-Length: 0

Note: Update operations return an empty response body on success.


Read Action

The Read Action exposes an endpoint for retrieving a single record by its identifier.

Read Action Configuration

PropertyRequiredDescription
Endpoint NameYesURL path segment (e.g., get, producing /{module}/{entity}/{id}/get)
Retrieve Attachment ListNoInclude list of attachments in response

Properties Configuration

Properties define which fields are returned in the API response:

Property AttributeDescription
Field NameThe Dataverse field to include
API NameThe name used in the JSON response
TypeData type for serialization
ExpandFor lookups, which related fields to include
ComputedCalculated values derived from other fields

Retrieve Attachment List

When enabled, the response includes metadata about all attachments:

{
"accountId": "...",
"name": "Contoso Ltd",
"attachments": [
{
"attachmentId": "note-guid-1",
"fileName": "contract.pdf",
"fileSize": 245678,
"mimeType": "application/pdf",
"createdOn": "2024-01-15T10:30:00Z",
"createdBy": "John Smith"
}
]
}

API Request

GET /sales/account/a1b2c3d4-e5f6-7890-abcd-ef1234567890/get
Authorization: Bearer {token}

API Response

Success (200 OK):

{
"accountId": "a1b2c3d4-...",
"name": "Contoso Ltd",
"telephone1": "+1-555-0100",
"emailAddress1": "info@contoso.com",
"primaryContact": {
"id": "contact-guid",
"name": "Jane Doe"
}
}

Not Found (404): When the record doesn't exist, the Read action returns 404 Not Found with an error body (errorCode: "NOT_FOUND").


Delete Action

The Delete Action exposes an endpoint for removing records. Delete operations typically require the strictest access control.

Delete Action Best Practices

Data Fetcher Considerations:

  • Verify the record exists before deletion
  • Check for related records that would be orphaned
  • Validate business rules (status, ownership, time restrictions)
  • Gather audit information before deletion

Common Pre-conditions:

Pre-condition TypeExample
Record existsReturn 404 if not found
Record is inactiveRequire deactivation before deletion
No dependent recordsPrevent orphaning child records
Ownership checkOnly owner or admin can delete
Approval statusCannot delete approved/finalized records

API Request

DELETE /sales/account/a1b2c3d4-e5f6-7890-abcd-ef1234567890/delete
Authorization: Bearer {token}

API Response

Success (200 OK):

HTTP/1.1 200 OK
Content-Length: 0

Upload Action

The Upload Action allows a file to be attached to an entity record. It accepts a single multipart/form-data file in a form field named file. The record id comes from the route.

Upload Configuration

PropertyRequiredDescription
NameYesEndpoint name (URL path segment, e.g. "upload-documents")
Attachment NameNoExpression that names the created attachment (annotation subject)
Allow MultipleNoWhether multiple attachments may be created on the record

API Request

POST /support/incident/{caseId}/upload-documents
Content-Type: multipart/form-data
Authorization: Bearer {token}

------WebKitFormBoundary
Content-Disposition: form-data; name="file"; filename="document.pdf"
Content-Type: application/pdf

[file binary data]
------WebKitFormBoundary--

API Response

Success (200 OK):

HTTP/1.1 200 OK
Content-Length: 0

If the referenced upload action or record cannot be resolved, the engine returns 404 Not Found or a 400 Bad Request with errorCode: "ARGUMENT_VALIDATION_ERROR".


Download Action

The Download Action retrieves a specific attachment from an entity record. The record id and the attachment id (aid) both come from the route, producing /{module}/{entity}/{id}/{endpoint-name}/{attachmentId}.

Download Configuration

PropertyRequiredDescription
NameYesEndpoint name (URL path segment)

API Request

GET /support/incident/{caseId}/download/{attachmentId}
Authorization: Bearer {token}

API Response

Success (200 OK): Returns the file binary data with appropriate headers:

HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="contract.pdf"
Content-Length: 245678

[file binary data]

Not Found (404):

{
"errorCode": "NOT_FOUND",
"errorMessage": "The requested attachment was not found"
}

Process Action

Process Actions expose Dataverse custom actions (processes) through the API. They can be either Local (bound to an entity) or Global (unbound).

Process Action Types

TypeURL PatternUse Case
LocalPOST /{module}/{entity}/{action}?id={id}Entity-bound operations (record id passed as a required query parameter)
GlobalPOST /{module}/{action}Cross-entity or standalone operations

Process Action Binding

Process Input Arguments: Maps API inputs to the custom action's input parameters.

PropertyDescription
Process ArgumentThe custom action's input parameter name
BindingThe API input, fetched data, or expression to use

Process Output Arguments: Maps the custom action's output parameters to the API response.

PropertyDescription
Process ArgumentThe custom action's output parameter name
Response FieldThe field name in the API response
TransformOptional transformation before returning

API Request Example

POST /sales/account/approve?id={accountId}
Content-Type: application/json
Authorization: Bearer {token}

{
"approvalNotes": "Credit check passed",
"creditLimit": 50000.00
}

API Response

Success (200 OK):

{}

Note: Process actions typically return an empty response body on success, or may return output parameters if defined.