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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom code to remove ...
Power Automate
Unanswered

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.

Categories:
I have the same question (0)
  • Verified answer
    tstaylor Profile Picture
    9 on at

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard