web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to read query para...
Power Automate
Unanswered

How to read query parameters using custom connector in C#

(0) ShareShare
ReportReport
Posted on by 4

I have created a custom connector defining the below query parameters. Now, I need to fetch query parameter values and then transform it before sending the request to third-party API. As you can see below, I have defined these parameters under Query section.

AAW23_0-1712168500773.png

 

Now, I have written the below code in c#, but I am not able to fetch parameter values from JSON object. Now, if I define these parameters in the body section then I am able to fetch it. See below.

 

 private async Task<HttpResponseMessage> TransformRequestAndResponse()
    {
        HttpResponseMessage response;
        var contentAsString = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false);      
        var contentAsJson = JObject.Parse(contentAsString);        
 
        // Fetch parameter values from the request payload. Below code highlighted in red isn't fetching the parameter values since these values are part of Query parameters. 
        var formIdvalue = (string)contentAsJson["formID"];
        var workspaceIdvalue = (string)contentAsJson["workspaceID"];
        var projecttitlevalue = (string)contentAsJson["projectTitle"];
        var requesterIdvalue = (string)contentAsJson["requesterID"];
        var requesterNamevalue = (string)contentAsJson["requesterName"];
        
         this.Context.Request.Content = CreateJsonContent(contentAsJson.ToString());

        // Sending the connector API request
        response = await this.Context.SendAsync(this.Context.Request, this.CancellationToken).ConfigureAwait(continueOnCapturedContext: false);
        
       // Manipulate the response data before returning it
        var responseContentAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
        var responseContentAsJson = JObject.Parse(responseContentAsString);
        response.Content = CreateJsonContent(responseContentAsJson.ToString());

        return response;
    }

 

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 245 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard