Skip to main content
Solved

Delete multiple cards by GraphQL mutation

  • July 28, 2023
  • 1 reply
  • 237 views

Daniel Angelini Serviços
Forum|alt.badge.img+1

Hey there, anyone knows how to delete multiple cards, by their Id, with graphQL mutation? I tried this:

mutation {

  deleteCard(input: {id: [751517290,751517292,751517294,751517296,751517297,751517299,751517300,751517305,751517318,751517343,751517344,751517345,751517346,751517347,751517348,751517349,751517352,751517353,751517355,751517356,751517358,751517360,751517361,751517363,751517364,751517366,751517367,751517368]}) {

    success

  }

}

and received this:

{

    "errors": [

        {

            "message": "Argument 'id' on InputObject 'DeleteCardInput' has an invalid value ([751517290, 751517292, 751517294, 751517296, 751517297, 751517299, 751517300, 751517305, 751517318, 751517343, 751517344, 751517345, 751517346, 751517347, 751517348, 751517349, 751517352, 751517353, 751517355, 751517356, 751517358, 751517360, 751517361, 751517363, 751517364, 751517366, 751517367, 751517368]). Expected type 'ID!'.",

            "locations": [

                {

                    "line": 3,

                    "column": 21

                }

            ],

            "path": [

                "mutation",

                "deleteCard",

                "input",

                "id"

            ],

            "extensions": {

                "code": "argumentLiteralsIncompatible",

                "typeName": "InputObject",

                "argumentName": "id"

            }

        }

    ]

}

Can anyone help?

Thanks

 

Best answer by genietim

The trick is to do the same mutation multiple times in the same query:

mutation {
N0 :deleteCard(input:{id: "..."}){ clientMutationId }
N1 :deleteCard(input:{id: "..."}){ clientMutationId }
N2 :deleteCard(input:{id: "..."}){ clientMutationId }
N3 :deleteCard(input:{id: "..."}){ clientMutationId }
N4 :deleteCard(input:{id: "..."}){ clientMutationId }
N5 :deleteCard(input:{id: "..."}){ clientMutationId }
N6 :deleteCard(input:{id: "..."}){ clientMutationId }
N7 :deleteCard(input:{id: "..."}){ clientMutationId }
N8 :deleteCard(input:{id: "..."}){ clientMutationId }
N9 :deleteCard(input:{id: "..."}){ clientMutationId }
N10 :deleteCard(input:{id: "..."}){ clientMutationId }
N11 :deleteCard(input:{id: "..."}){ clientMutationId }
N12 :deleteCard(input:{id: "..."}){ clientMutationId }
N13 :deleteCard(input:{id: "..."}){ clientMutationId }
N14 :deleteCard(input:{id: "..."}){ clientMutationId }
N15 :deleteCard(input:{id: "..."}){ clientMutationId }
N16 :deleteCard(input:{id: "..."}){ clientMutationId }
N17 :deleteCard(input:{id: "..."}){ clientMutationId }
N18 :deleteCard(input:{id: "..."}){ clientMutationId }
N19 :deleteCard(input:{id: "..."}){ clientMutationId }
N20 :deleteCard(input:{id: "..."}){ clientMutationId }
N21 :deleteCard(input:{id: "..."}){ clientMutationId }
N22 :deleteCard(input:{id: "..."}){ clientMutationId }
N23 :deleteCard(input:{id: "..."}){ clientMutationId }
N24 :deleteCard(input:{id: "..."}){ clientMutationId }
}

the “N...” prefix can be chosen by you (no need to use N, just some alphanumeric identifier for the separate queries so you can differentiate between the results).

 

Note that there is a limit for how many you can do simulataneously; I think somewhere around 30 or 50, but please try and report back.

1 reply

genietim
Forum|alt.badge.img+12
  • Legend
  • 412 replies
  • Answer
  • July 28, 2023

The trick is to do the same mutation multiple times in the same query:

mutation {
N0 :deleteCard(input:{id: "..."}){ clientMutationId }
N1 :deleteCard(input:{id: "..."}){ clientMutationId }
N2 :deleteCard(input:{id: "..."}){ clientMutationId }
N3 :deleteCard(input:{id: "..."}){ clientMutationId }
N4 :deleteCard(input:{id: "..."}){ clientMutationId }
N5 :deleteCard(input:{id: "..."}){ clientMutationId }
N6 :deleteCard(input:{id: "..."}){ clientMutationId }
N7 :deleteCard(input:{id: "..."}){ clientMutationId }
N8 :deleteCard(input:{id: "..."}){ clientMutationId }
N9 :deleteCard(input:{id: "..."}){ clientMutationId }
N10 :deleteCard(input:{id: "..."}){ clientMutationId }
N11 :deleteCard(input:{id: "..."}){ clientMutationId }
N12 :deleteCard(input:{id: "..."}){ clientMutationId }
N13 :deleteCard(input:{id: "..."}){ clientMutationId }
N14 :deleteCard(input:{id: "..."}){ clientMutationId }
N15 :deleteCard(input:{id: "..."}){ clientMutationId }
N16 :deleteCard(input:{id: "..."}){ clientMutationId }
N17 :deleteCard(input:{id: "..."}){ clientMutationId }
N18 :deleteCard(input:{id: "..."}){ clientMutationId }
N19 :deleteCard(input:{id: "..."}){ clientMutationId }
N20 :deleteCard(input:{id: "..."}){ clientMutationId }
N21 :deleteCard(input:{id: "..."}){ clientMutationId }
N22 :deleteCard(input:{id: "..."}){ clientMutationId }
N23 :deleteCard(input:{id: "..."}){ clientMutationId }
N24 :deleteCard(input:{id: "..."}){ clientMutationId }
}

the “N...” prefix can be chosen by you (no need to use N, just some alphanumeric identifier for the separate queries so you can differentiate between the results).

 

Note that there is a limit for how many you can do simulataneously; I think somewhere around 30 or 50, but please try and report back.