최근 검색


최근 검색 없음

Andres Olvera's Avatar

Andres Olvera

가입한 날짜: 2021년 5월 28일

·

마지막 활동: 2021년 10월 16일

팔로잉

0

팔로워

0

총 활동 수

3

투표 수

0

가입 플랜

1

활동 개요

님의 최근 활동 Andres Olvera

Andres Olvera님이 에 댓글을 입력함

커뮤니티 댓글 Developer - Zendesk Apps Framework (ZAF)

Ok, leaving this here in case someone else runs into the same issue.

The way I solved the request above is by using the `print` method from graphql package, and stringifying my query variables, like this:

import { print } from 'graphql/language/printer'
...
client.request({
url: 'https://api.monday.com/v2/',
headers: {
"Authorization": "Bearer {{setting.token}}"
},
cors: false,
secure: true,
contentType: 'application/json',
method: 'POST',
data: {
query: print(require('../graphql/MyBoardsQuery.gql')), // <== using gql to make it cleaner
variables: JSON.stringify({ ids: [this.boardId] })
})
}).then(results => {
console.log("zd client request results", results)
}).catch(error => {
console.log("zd client request error:", error)
})

댓글 보기 · 2021년 3월 17일에 게시됨 · Andres Olvera

0

팔로워

0

투표 수

0

댓글


Andres Olvera님이 에 댓글을 입력함

커뮤니티 댓글 Developer - Zendesk Apps Framework (ZAF)

Hi, I'm sorry if I'm posting this in the wrong place, I just can't find anywhere specific for my problem.. 

I'm trying to send a request to monday.com's GraphQL API but I'm getting a few different responses depending on the various settings I have tried.

Sometimes I get an empty responseText and statusText: "error", sometimes something like "Internal Proxy error", and sometimes, when the request does return a 200 response, I get "No query string was present".. I have tried a few different variations to my data parameter but nothing seems to work.. Is there a specific way of sending a GraphQL payload to client request, or am I missing some extra parameter in muy request?

Here's my request:

client.request({
url: 'https://api.monday.com/v2/',
headers: {
"Authorization": "Bearer {{setting.token}}"
},
cors: false, // <== I have tried with cors: true and without cors param
secure: true,
contentType: 'application/json',
method: 'POST',
data: JSON.stringify({
query: 'query {\n boards {\n id\n }\n}'
})
}).then(results => {
console.log("zd client request results", results)
}).catch(error => {
console.log("zd client request error:", error)
})

댓글 보기 · 2021년 3월 17일에 게시됨 · Andres Olvera

0

팔로워

0

투표 수

0

댓글