I am trying to use powerShell script to get data from graphql queery but have been getting this error.
I have correct bearer token as I have tried using same token in postman and getting the required result…
$graphqlUri = "https://api.zoom.us/v3/graphql"
$graphqlQuery = @"
query GetUserMeetingInfo(${meetingQueryType}: MeetingQueryType!, ${withDurationInMinutes}: Boolean!) {
aggrUser: user(userId: "me") {
...userInfoAndMeetings
}
}
fragment userInfoAndMeetings on User {
profile {
id
firstName
email
type
personalMeetingId
group
{
name
id
}
}
meetings(first: 10, meetingType: $meetingQueryType) {
edges {
id
topic
type
durationInMinutes @include(if: $withDurationInMinutes)
}
pageInfo {
hasNextPage
cursor
}
}
}
"@
$variables = @{
meetingQueryType = "SCHEDULED"
withDurationInMinutes = $true
}
# Setting headers for GraphQL request
$graphqlHeaders = @{
"Authorization" = "Bearer $bearerToken"
"Content-Type" = "application/json"
}
# Setting the body as JSON with the query and variables
$graphqlBody = @{
query = $graphqlQuery
variables = $variables
} | ConvertTo-Json
# Make the GraphQL API call
#$graphqlResponse = Invoke-RestMethod -Uri $graphqlUri -Method 'POST' -Headers $graphqlHeaders -Body $graphqlBody
# Make the GraphQL API call using Invoke-WebRequest
$graphqlResponse = Invoke-WebRequest -Uri $graphqlUri -Method 'POST' -Headers $graphqlHeaders -Body $graphqlBody
Line |
163 | … lResponse = Invoke-RestMethod -Uri $graphqlUrl -Method 'POST' -UseBas …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"timestamp":1689966415021,"status":500,"error":"Internal Server Error","path":"/nws/openapi/graphql"}
null
Line |
95 | … lResponse = Invoke-WebRequest -Uri $graphqlUri -Method 'POST' -Header …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"timestamp":1690003896198,"status":500,"error":"Internal Server Error","path":"/nws/openapi/graphql"}```
Tried to use RestMethod and WebRequest but is the same error