Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi
I'm able to get the data in Postman using Graphql for Jira APIs. I need to get the data in Power query editor through API call.
Every time I'm trying it gives me an error like " Bad JSON passed in body".
{
"info": {
"_postman_id": "c77632df-55ce-483f-a902-d1798c919b43",
"name": "graphQl",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "24457230"
},
"item": [
{
"name": "graphQl Copb",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "",
"type": "string"
},
{
"key": "password",
"value": "",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Basic cHZhbGFAYXNpdGUuY29tOnlpYWZkNEVyS2ZJaW5RWDFjZmZ3MEEwRA=="
}
],
"body": {
"mode": "graphql",
"graphql": {
"query": "query UserDetails($userId: String!, $cloudId: String!) {\r\n CloudUser(userId: $userId, cloudId: $cloudId) {\r\n id\r\n fullName\r\n isCurrentUser\r\n title\r\n department\r\n companyName\r\n location\r\n timezone\r\n email\r\n phoneNumber\r\n }\r\n}\r\n",
"variables": "{\n \"cloudId\": \"\",\n \"userId\": \"5ef277e48624070abc52add2\"\n}"
}
},
"url": {
"raw": "https://asitehelpdesk.atlassian.net/gateway/api/directory/graphql?q=UserDetails",
"protocol": "https",
"host": [
"asitehelpdesk",
"atlassian",
"net"
],
"path": [
"gateway",
"api",
"directory",
"graphql"
],
"query": [
{
"key": "q",
"value": "UserDetails"
}
]
}
},
"response": []
}
]
}
Please help to get the data in power query editor.
hi @dufoq3 Please can you also check, If it is possible.
Hi @vbharakhada
Not sure if this would work. You may give it a try.
let
api_url = "https://asitehelpdesk.atlassian.net/",
relative_path = "gateway/api/directory/graphql",
Username = "your_username",
Password = "your_password",
EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(Username & ":" & Password), BinaryEncoding.Base64),
body = "{""query"": ""query UserDetails($userId: String!, $cloudId: String!) {#(cr)#(lf) CloudUser(userId: $userId, cloudId: $cloudId) {#(cr)#(lf) id#(cr)#(lf) fullName#(cr)#(lf) isCurrentUser#(cr)#(lf) title#(cr)#(lf) department#(cr)#(lf) companyName#(cr)#(lf) location#(cr)#(lf) timezone#(cr)#(lf) email#(cr)#(lf) phoneNumber#(cr)#(lf) }#(cr)#(lf)}#(cr)#(lf)"", ""variables"": {""cloudId"": """", ""userId"": ""5ef277e48624070abc52add2""}}",
Response = Json.Document(
Web.Contents(
api_url,
[
RelativePath = relative_path,
Query = [q = UserDetails],
Headers = [#"Content-Type" = "application/json", #"Authorization" = EncodedCredentials],
Content = Text.ToBinary(body)
]
)
)
in
Response
Or
let
api_url = "https://asitehelpdesk.atlassian.net/",
relative_path = "gateway/api/directory/graphql",
// Username = "your_username",
// Password = "your_password",
// EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(Username & ":" & Password), BinaryEncoding.Base64),
body = "{""query"": ""query UserDetails($userId: String!, $cloudId: String!) {#(cr)#(lf) CloudUser(userId: $userId, cloudId: $cloudId) {#(cr)#(lf) id#(cr)#(lf) fullName#(cr)#(lf) isCurrentUser#(cr)#(lf) title#(cr)#(lf) department#(cr)#(lf) companyName#(cr)#(lf) location#(cr)#(lf) timezone#(cr)#(lf) email#(cr)#(lf) phoneNumber#(cr)#(lf) }#(cr)#(lf)}#(cr)#(lf)"", ""variables"": {""cloudId"": """", ""userId"": ""5ef277e48624070abc52add2""}}",
Response = Json.Document(
Web.Contents(
api_url,
[
RelativePath = relative_path,
Query = [q = UserDetails],
Headers = [#"Content-Type" = "application/json", #"Authorization" = "Basic cHZhbGFAYXNpdGUuY29tOnlpYWZkNEVyS2ZJaW5RWDFjZmZ3MEEwRA=="],
Content = Text.ToBinary(body)
]
)
)
in
Response
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |