How to extract data using graph ql

Hi I need to extract BoardID name,itemID name and date created and date updated

{“query”:"{ boards{ id name columns { title id type } groups { title id } items { id name group { id } column_values { id text value }}}} "}

i use like above but i can find date column how to extract date with respet to item

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 @codyfrisch 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
}
}
}
}
}