Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

The customHeaders parameter in API-related methods required Dictionary<String, List<String>>, forcing users to wrap single header values in lists unnecessarily.

Changes

  • DataManagementTools.cs: Updated parameter type from Dictionary<String, List<String>> to Dictionary<string, string> in:

    • ExecuteWebApi
    • CreateRecord
    • UpdateRecord
    • UpsertRecord
    • DeleteRecord
  • DataManagementHelper.cs: Added ConvertCustomHeaders to transform simplified headers to the format expected by ServiceClient.ExecuteWebRequestAsync

Usage

Before:

var headers = new Dictionary<string, List<string>> 
{
    { "Prefer", new List<string> { "return=representation" } }
};
await CreateRecord(client, "accounts", payload, headers);

After:

var headers = new Dictionary<string, string> 
{
    { "Prefer", "return=representation" }
};
await CreateRecord(client, "accounts", payload, headers);
Original prompt

This section details on the original issue you should resolve

<issue_title>Modify the customHeaders method argument in API related methods</issue_title>
<issue_description>- Change the argument data type for customHeaders method argument from Dictionary<String, List> to Dictionary<String, String>.

  • The change should be done in the following methods:
  1. ExecuteWebApi()
  2. CreateRecord()
  3. UpdateRecord()
  4. UpsertRecord()
  5. DeleteRecord()
  • Additional custom headers can be sent using customHeaders argument as a Dictionary. Key is the header name. Value is the header value string. If a Header contains multiple values pass it as comma-separated string. For eg: Multiple Prefer headers can be specified using comma-separated values; for example: Key = Prefer , Value = respond-async,odata.include-annotations="*"
  • Update the Description Attribute for the customHeaders argument such that the LLM agent should understand the syntax correctly and pass the values accordingly.
  • update the method implementation to convert the Dictionary<String, String> to Dictionary<String, List> before passing it into ExecuteWebRequestAsync(). comma-separated string value should be converted to List.
  • Also make any other appropriate changes to the logic if needed.

For more info refer:

  1. https://learn.microsoft.com/en-us/dotnet/api/microsoft.powerplatform.dataverse.client.serviceclient.executewebrequestasync?view=dataverse-sdk-latest
  2. https://learn.microsoft.com/en-us/power-apps/developer/data-platform/xrm-tooling/use-xrm-tooling-to-execute-web-request</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 2, 2025 17:24
…ng>> to Dictionary<string, string>

Co-authored-by: vignaesh01 <13076411+vignaesh01@users.noreply.github.com>
Co-authored-by: vignaesh01 <13076411+vignaesh01@users.noreply.github.com>
Copilot AI changed the title [WIP] Modify customHeaders method argument in API methods Simplify customHeaders parameter type from Dictionary<String, List<String>> to Dictionary<string, string> Nov 2, 2025
Copilot AI requested a review from vignaesh01 November 2, 2025 17:28
Copilot finished work on behalf of vignaesh01 November 2, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify the customHeaders method argument in API related methods

2 participants