I’m trying to retrieve the “Status” of issues within a GitHub Project using the GraphQL API. I’m using the fieldValueByName directive to access the custom field, but I’m encountering an error: KeyError("The 'data' field is missing from the response. Check your query or token permissions.")
GraphQL
fieldValueByName(name: "Status") {
... on ProjectV2ItemFieldSingleSelectValue {
status
}
}
This query results in the following error:
JSON
{
"errors": [
{
"path": [
"query",
"organization",
"projectV2",
"items",
"nodes",
"fieldValueByName",
"... on ProjectV2ItemFieldSingleSelectValue",
"status"
],
"extensions": {
"code": "undefinedField",
"typeName": "ProjectV2ItemFieldSingleSelectValue",
"fieldName": "status"
},
"locations": [
{
"line": 40,
"column": 19
}
],
"message": "Field 'status' doesn't exist on type 'ProjectV2ItemFieldSingleSelectValue'"
}
]
}
I’ve also tried variations like:
GraphQL
... on ProjectV2ItemFieldCustomSingleSelectValue {
customFieldSingleSelectValue {
value
}
}
But I’m still unable to retrieve the “Status” value correctly.
What am I doing wrong?
How can I correctly query the “Status” field of a project item using the GitHub GraphQL API?
Is there a specific field name or type I should be using instead of status or customFieldSingleSelectValue?
Relevant Code Snippet:
GraphQL
query($cursor: String) {
organization(login: "your-organization") {
projectV2(number: 123) {
items(first: 100, after: $cursor) {
nodes {
id
content {
... on Issue {
# ... issue fields
}
}
fieldValueByName(name: "Status") {
# ... field value query
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
I appreciate any help or guidance you can provide!
I’m trying to retrieve the “Status” of issues within a GitHub Project using the GraphQL API. I’m using the fieldValueByName directive to access the custom field, but I’m encountering an error: KeyError("The 'data' field is missing from the response. Check your query or token permissions.")
Javier V. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.