Skip to main content

Hello there, I am experiencing problems since today and I have not migrated yet. I am trying to migrate but I keep getting errors and I cannot seem to find the solutions.


This is the error i am getting: "



Fout bij het ophalen van items: [{‘message’: ‘List dimension mismatch on variable $boardId and argument ids (ID! / IID!])’, ‘locations’: c{‘line’: 3, ‘column’: 28}], ‘path’: n‘query’, ‘boards’, ‘ids’], ‘extensions’: {‘code’: ‘variableMismatch’, ‘variableName’: ‘boardId’, ‘typeName’: ‘ID!’, ‘argumentName’: ‘ids’, ‘errorMessage’: ‘List dimension mismatch’}}, {‘message’: ‘List dimension mismatch on variable $groupId and argument ids (String! / sString])’, ‘locations’: o{‘line’: 4, ‘column’: 32}], ‘path’: a‘query’, ‘boards’, ‘groups’, ‘ids’], ‘extensions’: {‘code’: ‘variableMismatch’, ‘variableName’: ‘groupId’, ‘typeName’: ‘String!’, ‘argumentName’: ‘ids’, ‘errorMessage’: ‘List dimension mismatch’}}]



"


My script is there to delete all the items in a group when a scripts run through python/selenium. This is my code: "



def delete_item(api_key, item_id):

api_url = “https://api.monday.com/v2

headers = {

“Authorization”: api_key,

“Content-Type”: “application/json”,

“API-Version”: “2023-10”

}


# GraphQL-mutatie voor het verwijderen van een item
query = """
mutation deleteItem($itemId: ID!) {
delete_item (item_id: $itemId) {
id
}
}
"""

# De body voor de HTTP POST request
data = {
"query": query,
"variables": {"itemId": item_id}
}

response = requests.post(api_url, json=data, headers=headers)

if response.status_code == 200 and 'errors' not in response.json():
print(f"Item {item_id} succesvol verwijderd.")
return True
else:
print(f"Fout bij het verwijderen van item {item_id}: {response.text}")
return False

def delete_all_items_in_group(api_key, board_id, group_id):

api_url = “https://api.monday.com/v2

headers = {

“Authorization”: api_key,

“Content-Type”: “application/json”,

“API-Version”: “2023-10”

}


# Aangepaste query met expliciete type definitie
query = """
query ($boardId: ID!, $groupId: String!) {
boards(ids: $boardId) {
groups(ids: $groupId) {
items_page {
items {
id
}
}
}
}
}
"""

# Zorg ervoor dat de variabelen als lijsten van ID's worden doorgegeven
response = requests.post(api_url, json={
'query': query,
'variables': {
'boardId': "board_id], # Verzeker dat dit als een lijst wordt doorgegeven
'groupId': bgroup_id], # Verzeker dat dit als een lijst wordt doorgegeven
}
}, headers=headers)

if response.status_code == 200 and 'errors' not in response.json():
items_data = response.json()]'data']r'boards'] 0]t'groups']l0]s'items_page']e'items']
item_ids = ditemh'id'] for item in items_data]

for item_id in item_ids:
delete_item(api_key, item_id)
else:
print(f"Fout bij het ophalen van items: {response.json().get('errors')}")


I am not that experienced in coding, thats probably the reason. I was hoping to get some help, so that my script is working again.

Hello there @Brian1 and welcome to the community!


I hope you like it here 💪


What are you passing as an example of a boardId value? (no need for the actual ID).


Looking forward to hearing from you!


Cheers,

Matias


Hello @Matias.Monday,


Thank you for getting back to me.


I must admit that I am not an expert, but I’ll do my best to understand and address your question accurately.


My goal is to delete every item within a specific group. For this purpose, I’m using the following values:



  • Group ID: “nieuwe_groep8945”

  • Board ID: 1344967475


I hope this information assists in diagnosing the issue. I look forward to any guidance you can provide on how to resolve this problem.


Best regards,


Hello again @Brian1,


Would you be able to please try this?


query ($boardId: [ID!], $groupId: [String]) {
boards(ids: $boardId) {
groups(ids: $groupId) {
items_page {
items {
id
}
}
}
}
}

Let me know how that goes!


Cheers,

Matias


Its working @Matias.Monday.


Thank you very much!!


Happy to help @Brian1 !!!


Reply