Hello there @Channa,
You can use a query like this one:
{
boards(ids: 1234567890) {
id
name
columns {
title
id
type
}
groups {
title
id
}
items_page(limit: 500) {
cursor
items {
created_at
updated_at
id
name
group {
id
}
column_values {
id
text
value
}
}
}
}
}
I hope that helps!
Cheers,
Matias
Thank you @matis
i am using REST query
sample :{“query”:"{ boards{ id name columns { title id type } groups { title id } items { id name group { id } column_values { id text value }}}} "}
is it possible to convert like above
Hello again,
If you are referring to the format, you just need to put everything in the same line like this:
"query": "{boards(ids: 1234567890) {id name columns {title id type } groups { title id } items_page(limit: 500) { cursor items { created_at updated_at id name group { id} column_values { id text value} } } } }"
Cheers,
Matias
Hi Matias,
i tried query on postman dosnet bring results
could you suggest any changes to query
What @Matias.Monday posted is the JSON body of the request built from from the contents of the QUERY and VARIABLES panes in Postman by Postman.
What you want in the Postman QUERY pane is as follows:
query($boardIds: [ID!]){boards(ids: $boardId) {id name columns {title id type } groups { title id } items_page(limit: 500) { cursor items { created_at updated_at id name group { id} column_values { id text value} } } } }
Postman then puts that in the query key of the JSON it sends:
{
"query": "query($boardIds: [ID!]){boards(ids: $boardId) {id name columns {title id type } groups { title id } items_page(limit: 500) { cursor items { created_at updated_at id name group { id} column_values { id text value} } } } }",
"variables" : {
"boardIds: ["1234567890"]
}
}
In my example I’ve included the variables that you put in the right side of Postman - in this case for the boardID (which in a query is an array of IDs, which can be strings or numeric - i recommend standardizing on strings, since that is how they are returned in queries).
Postman takes the query and variables panes, and turns them into the above JSON (each one of course being in its respective key). GraphQL queries are simple strings, and treated as a single string when being turned into JSON by Postman.
sorry for bothering you again
i am seeing different error items-page not found
is my variable passing is correct?
Have you forgotten to set a header api-version: 2023-10
? While 2023-10 is live it, it is not the default version and must be specified with a header.
items_page
only exists on 2023-10
Hi Cody,
i added the version
am i passing variable correctly ? i never use graphql before
Hello again @Channa I see you are passing “boardIds” in the variables, but in the body of the request you are using “boardId”. No “s” at the end.
I hope that helps!
By the way thank you @anon29275264 for the help!
Cheers,
Matias
may be this query have some issues
dosent bring any data
i tried both
Hello again,
You are using a user’s API token to make the HTTP request.
You might be using the token of a user who does not have access to that board.
Try this with a board in which the user whose API token is being used is a board owner. If you can see data, it is probably a permissions issue.
Cheers,
Matias
i can execute the json, and i saw data also
Hello again @Channa,
You might see some data for things the user whose API token is being used has access to.
Maybe the user has access to board A and not board B.
In that case, via API you would see results for board A, but not for board A.
Cheers,
Matias
that code you send works fine but i need it as graphQL query
can you convert into graphql below json
{
boards(ids: 1259091456) {
id
name
columns {
title
id
type
}
groups {
title
id
}
items_page(limit: 500) {
cursor
items {
created_at
updated_at
id
name
group {
id
}
column_values {
id
text
value
}
}
}
}
}
Hi @Channa,
I am not sure I follow. What you sent is GraphQL.
I am able to execute the JSON which you shared with me in the first response
same results i want with GraphQL query
you can just copy the string value of “query” from the JSON and you have the graphql string.
Yes it is not GraphQL i need same result as above JSON, in graphQL
This Below is fetching data what i want i just need this JASON in graphQL
{
boards(ids: 1259091456) {
id
name
columns {
title
id
type
}
groups {
title
id
}
items_page(limit: 500) {
cursor
items {
created_at
updated_at
id
name
group {
id
}
column_values {
id
text
value
}
}
}
}
}
A GraphQL request is JSON, a GraphQL query is a string. The JSON is the following structure:
{
"query": "graphql query string",
}
Usually you create the JSON using code, there is no need to provide it directly. (this is javascript, but similar applies in any language).
//the GraphQL query string
const query = `{
boards(ids: 1259091456) {
id
name
columns {
title
id
type
}
groups {
title
id
}
items_page(limit: 500) {
cursor
items {
created_at
updated_at
id
name
group {
id
}
column_values {
id
text
value
}
}
}
}
}`
const requestObject = { query };//creates the request object.
const requestBody = JSON.stringify(requestObject); //stringify the object to JSON.
//or -- const requestBody = JSON.stringify({query});
// if you are using the monday-sdk-js, it creates the JSON for you, just supply the query
// string.
const response = await monday.api(query);
There isn’t a need for us to provide it as JSON. You provide the graphql query as a string in code - and create the JSON at run time. There is no need to type it out as JSON in advance.
Thank you @anon29275264 for the explanation for @Channa !
this query is extracting data in postman
but when i use this query in REST
i get error
RestConnectorMasterTable:
SQL SELECT
“account_id”,
“__KEY_root”,
(SELECT
“message”,
“__FK_errors”
FROM “errors” FK “__FK_errors”)
FROM JSON (wrap on) “root” PK “__KEY_root”;
Hello @Channa,
It is not clear to me what you are trying to do here.
Looks like an SQL request.
Our API works using GraphQL. You need to follow our documentation here.
Here are lots of Postman examples on how to do it.
If you are trying to use SQL in your query to our API, it will not work.
Please follow the documentation and the examples.
Cheers,
Matias