Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Connector Development
Answered

Custom code to remove API key query parameter

(0) ShareShare
ReportReport
Posted on by 9

I'm working on a custom connector that uses an API key query parameter for authentication. All of the actions use this parameter with one exception where the API key has to be passed as part of the POST body. Does anyone know of a way to remove the query parameter from the request or override the URL? I found Vivek's code from the Shopify connector (https://github.com/thatapiguy/PowerPlatformConnectors/blob/Shopify-Admin/independent-publisher-connectors/Shopify%20Admin%20Store/script.csx), but that is to add a header. I'm not familiar with the rest of System.Net.HTTP (System.Net.Http Namespace | Microsoft Docs) that should be doable in custom code.

  • Verified answer
    tstaylor Profile Picture
    9 on at
    Re: Custom code to remove API key query parameter

    I was finally able to get this working, just not using custom code. I ended up using a policy to set the query string parameter (for every other action) and used a @connectionParameter. After downloading the connector using paconn, I added the connectionParameter in apiProperties.json:

     

    {
     "properties": {
     "connectionParameters": {
     "API Key": {
     "type": "string",
     "uiDefinition": {
     "constraints": {
     "required": "true"
     },
     "description": "Please enter your API Key.",
     "displayName": "API Key"
     }
     }
     },
     "iconBrandColor": "#da3b01",
     "scriptOperations": [
     "AccessTokenGet"
     ],
     "capabilities": [],
     "policyTemplateInstances": [
     {
     "templateId": "setqueryparameter",
     "title": "Set API Key",
     "parameters": {
     "x-ms-apimTemplateParameter.name": "api_key",
     "x-ms-apimTemplateParameter.value": "@connectionParameters('API Key')",
     "x-ms-apimTemplateParameter.existsAction": "override",
     "x-ms-apimTemplate-operationName": [
     "ProjectInformationGet",
     "ProjectInformationSetIDs",
     "CampaignProjectGet",
     "CampaignSummaryProject",
     "ProjectCountryGet",
     "ProjectSummaryCountry",
     "ProjectTheme",
     "ProjectThemeSummary",
     "ProjectOrganization",
     "ProjectOrganizationSummary",
     "ProjectGet",
     "ProjectSummaryGet",
     "ProjectIDs",
     "ProjectFeatured",
     "ProjectFeaturedSummary",
     "ImageGallery",
     "OrganizationGet",
     "OrganizationGetAll",
     "InvoiceOutstanding",
     "ThirdPartyMax",
     "ProjectRegionCount",
     "RegionProjectCount",
     "RegionGet",
     "ProjectGetA",
     "ProjectSummary",
     "Themes",
     "ThemeProject",
     "ProjectSearch",
     "DonationSubmit",
     "GiftCardDesigns",
     "GiftCardSend",
     "GiftCertificateOrder",
     "GiftCertificateDetails"
     ]
     }
     }
     ],
     "publisher": "Troy Taylor"
     }
    }

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1

Featured topics