Now I want to query the items that I created as the code below to get item name, firstname, lastname etc.
$query = ' query{ items { id name firstname lastname } }';
Here is the error it displays
{"errors":[{"message":"Field 'firstname' doesn't exist on type 'Item'","locations":[{"line":1,"column":26}],"fields":["query","items","firstname"]},{"message":"Field 'lastname' doesn't exist on type 'Item'","locations":[{"line":1,"column":36}],"fields":["query","items","lastname"]}],"account_id":66xxxx}
In order to get column data, you can pass the column_values field with the ids argument to specify the exact columns you’d like to return using the column ID. (See Column Values query fields: https://api.developer.monday.com/docs/column-values)
Be sure to also include the boards field in your query, as it will make your call more specific.
This query will work instead:
query {
boards (ids: 1234567890) {
items {
id
name
column_values (ids: ["examplecolumnID", "examplecolumnID"]) {
title
value
}
}
}
}