Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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!