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! / [ID!])’, ‘locations’: [{‘line’: 3, ‘column’: 28}], ‘path’: [‘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! / [String])’, ‘locations’: [{‘line’: 4, ‘column’: 32}], ‘path’: [‘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': [group_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']['boards'][0]['groups'][0]['items_page']['items'] item_ids = [item['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.