Dynamics 365 Customer Insights

Client Library Generation

The tool used to generate the Customer Insights API client libraries is called AutoRest.

This page details how you can generate the libraries yourself using the same configuration as Customer Insights.

AutoRest tool

AutoRest is an Microsoft Azure tool.

More details can be found here:

The tool is installed via npmjs and Customer Insights uses the latest available:



AutoRest takes a API definition input in the form of an OpenAPI specification JSON.

You can download a copy of the Customer Insights API OpenAPI 3 JSON on the API Details page.

More details about the OpenAPI specification can be found here:

AutoRest Configuration

When generating the AutoRest libraries, there are a few transformation made to the OpenAPI JSON in the form of a "literate configuration" .yaml file.
More details can be found here: http://azure.github.io/autorest/user/literate-file-formats/configuration.html

Here are the transformation made (with some information on why):

Skip URL encoding on the relativePath query parameter - this transformation is made to allow for OData query parameters to be passed via the relativePath parameter without issue (e.g. Customer&$top=10)

- from: swagger-document
where: $..parameters[?(@.name == "relativePath")]
transform: $['x-ms-skip-url-encoding'] = true

Add a missing item-type for a identifiers array query parameter that was not retaining the value 

- from: swagger-document
where: $..parameters[?(@.name == "identifiers")].schema
transform: |
$.items = { 'type': 'string' }

Remove a redundant API operation (this operation is identical in functionality to Get-entities-with-OData-query-parameters, and we are able to control the URL encoding of that operation. The difference is only in format of the URI

- from: swagger-document
where: $..paths[?(@.get.operationId == "Get-entities-with-OData-path")]
transform: $ = null

AutoRest does not recognize none as a valid value for collectionFormat - per the OpenAPI specification, csv is the default: https://swagger.io/docs/specification/2-0/describing-parameters/#array. During configuration this is enforced.

- from: code-model-v1
where: $..[?(@.collectionFormat == "none")].collectionFormat
transform: $ = 'csv'

In the config, we specify generation of Java, Python, C# (csharp), and NodeJS libraries.


Finally, this is the command-line used to generate the libraries (we pin the AutoRest core version for ensuring expected reproduction of libraries):

autorest --v3 --version=3.0.6274 <path-to-config>