Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Query
Unanswered

POST API with double quotes in string

(0) ShareShare
ReportReport
Posted on by

I'm trying to set up a POST API call in Power BI, but the API has some requirements that are giving me trouble.  One of the fields requires multiple inputs separated by commas, with each input surrounded by double quotes and the whole shebang enclosed in another set of double quotes.  For example, a request may have this field set to "P12345","P23456".  I've tested the formatting in Postman, but unfortunately I'm having trouble getting the follow up Json.Document line to parse in Power BI.

 

Here's the code I'm working with:

 

let
//API URL
 URL = "https://some.url.com/api/download",
//Declare variables for the body of the POST request, convert to Query String
 Body = " {""apikey"": ""keygoeshere"", ""format"": ""CSV"", ""partNumbers"": " & List.First(PartsList) & " }",
 Parsed_JSON = Json.Document(Body),
 BuildQueryString = Uri.BuildQueryString(Parsed_JSON),
//Send POST request
 ZIPFile = Web.Contents(URL, [Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content = Text.ToBinary(BuildQueryString) ] ),

 


PartsList is a list of part numbers configured like I described in the first paragraph.  For some reason I can't get the list of parts to be treated as a single value, and instead Power Query is grabbing the first set of double quotes and returning an invalid character error when it gets to the second.  How can I get the query to treat the list of part numbers as a single value?

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Query

#1
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

#2
SD-13050734-0 Profile Picture

SD-13050734-0 6

#3
Rhys @ Empower 365 Profile Picture

Rhys @ Empower 365 2

Overall leaderboard

Featured topics