Skip to main content

Hi


Looking for some help whilst trying to add subscribers to a board using Python and the Monday API.


This is my code:


boardSubscribers = [25501753, 25614799, 25614800]


for i in boardSubscribers:

groupNameMonth = calendar.month_name[month]
print(groupNameMonth)
boardName = f'{groupNameMonth} {year}'

query = 'mutation ($boardName: String!, $boardSubscribers: Int!) {create_board (board_name: $boardName, board_kind: private, workspace_id: xxxxxx, board_subscriber_ids: $boardSubscribers) {id}}'

vars = {
'boardName' : boardName,
'boardSubscribers' : i
}
data = {'query' : query, 'variables' : vars}
r = requests.post(url=apiUrl, json=data, headers=headers)

I am getting the following error …


This is a test: {‘errors’: s{‘message’: ‘List dimension mismatch on variable $boardSubscribers and argument board_subscriber_ids (Int! / iInt])’, ‘locations’: {‘line’: 1, ‘column’: 140}], ‘fields’: l‘mutation’, ‘create_board’, ‘board_subscriber_ids’]}], ‘account_id’: xxxxxxx}

Traceback (most recent call last):

File “app.py”, line 45, in

boardID = createBoard()

File “app.py”, line 40, in createBoard

boardID = resp_dict ‘data’],‘create_board’]<‘id’]

KeyError: ‘data’


I know its a mismatch in data but I just cannot see what I am doing wrong. Any help would be greatly appreciated.

Be the first to reply!

Reply