Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
wdrain
Helper I
Helper I

How do you pass and escape chars from GraphQL Query into web.contents for a REST api connections?

Query:

query endpointsBitLockerDetails {
endpoints(after: null, first: 200) {
edges {
node {
id
computerID
isEncrypted
sensorReadings(sensors: [{name: "BitLocker Details"}, {name: "Enforce - TPM Status"}]) {
columns {
sensor {
name
}
name
values
}
}
}
}
pageInfo {
startCursor
endCursor
hasNextPage
}
totalRecords
}
}

 

Specifically how would  one update that "Enforce - TPM Status" be passed correctly ?

I was able to get "BitLocker Details"  working by modifying to \""BitLocker Details\""

5 REPLIES 5
v-cgao-msft
Community Support
Community Support

Hi @wdrain ,

 

Try surrounding the description value with triple quotes like this:

"""Enforce - TPM Status"""

For special characters in keys, you can refer to this:

Solved: Query parameter's with special characters - Microsoft Fabric Community

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi Gao

Unfortunely the triple quotes did not work and returned the following error

image.png

Hi @wdrain ,

 

What if you use double quotes like this?

vcgaomsft_1-1724919452652.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi Gao,

Thanks for replying back.
But unfortunely the double Quotes did not work.
In my finding variable names with out and dash work by escaping with a backslash \ and a double Qoute ". i.e.  \"
i.e.
\"BitLocker Details\" -> this works
\"Enforce -TPM Status\"  or \#"Enforce - TPM Status\" -> will not work because of the dash

Hi @wdrain ,

 

Is it possible to show the full code (masking the private information)? Please try again something like this:

 

let
    Source = Web.Contents(
	"https://apiurl",
	[
		Headers=[
			#"Method"="POST",
			#"Content-Type"="application/json",
			#"Authorization"="Bearer <your_token_here>"
		],
		Content=Text.ToBinary("{""query"": ""endpointsBitLockerDetails{endpoints(after: null, first: 200) {edges {node {idcomputerIDisEncryptedsensorReadings(sensors: [{name: \""BitLocker Details\""}, {name: \""Enforce - TPM Status\""}]) {columns {sensor {name}namevalues}}}}pageInfo {startCursorendCursorhasNextPage}totalRecords}}""}")
	]
    ),
    #"JSON" = Json.Document(Source)
in
    #"JSON"

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors