Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

GraphQL: Cannot moveProjectCard with the ID returned from Column.cards

Solved! Go to Solution.

First the query

fragment OnProject on Project {
    id
    name
    columns(first: 100) {
        nodes {
            name
            id
            cards(first: 100, archivedStates: NOT_ARCHIVED) {
                nodes {
                    content {
                        __typename 
                        ... OnIssue
                        ... OnPullRequest
                    }
                }
            }
        }
    }
}

fragment OnIssue on Issue {
    id
    title
    number
    state
}

fragment OnPullRequest on PullRequest {
    id
    title
    number
    state
}

query ProjectBoard($id: ID!) {
    node(id: $id) {
        ... OnProject
    }
}

And the mutation.

mutation MoveCardToColumn($card_id: ID!, $column_id: ID!) { 
    moveProjectCard(input: {cardId: $card_id, columnId: $column_id}) {
        clientMutationId
        cardEdge {
            node {
                column {
                    name
                }
            }
        }
    }
}

 


When I call the mutation with a cardId from the fragment of 'MDU6SXNzdWU0NjMzMDM4OTE=', the GraphQL API endpoint returns 

{'data': {'moveProjectCard': None},
 'errors': [{'type': 'NOT_FOUND', 'path': ['moveProjectCard'], 'locations': [{'line': 3, 'column': 9}], 'message': "Could not resolve to ProjectCard node with the global id of 'MDU6SXNzdWU0NjMzMDM4OTE='."}]}
1 Reply
Solution
Copilot Lvl 2
Message 2 of 2

Re: GraphQL: Cannot moveProjectCard with the ID returned from Column.cards

I wasn't using the id of the ProjectCard, but the ProjectCard.content. Changing my query to solved my issue.

fragment OnProject on Project {
    id
    name
    columns(first: 100) {
        nodes {
            name
            id
            cards(first: 100, archivedStates: NOT_ARCHIVED) {
                nodes {
                    id
                    title
                    content {
                        __typename 
                        ... OnIssue
                        ... OnPullRequest
                    }
                }
            }
        }
    }
}