【问题标题】:Not able to put tag column value on monday item无法将标签列值放在星期一项目上
【发布时间】:2022-12-10 07:34:43
【问题描述】:

我正在尝试使用 python 来自动化常见的 Monday 任务。我可以在看板中创建项目,但列 (type=tag) 没有更新。

我使用了这个教程: https://support.monday.com/hc/en-us/articles/360013483119-API-Quickstart-Tutorial-Python#

这是我正在执行的 graphql 代码:

query = 'mutation ($device: String!, $columnVals: JSON!) { create_item (board_id:<myboardid>, item_name:$device, column_values:$columnVals) { id } }' 
vars = {'device': device,
        'columnVals': json.dumps({
            'cloud_name6': {'text': cloudname}  # this is where i want to add a tag. cloud_name6 is id of the column.
        })
        } 
data = {'query' : query, 'variables' : vars}

r = requests.post(url=apiUrl, json=data, headers=headers) print(r.json())

我尝试将 id 更改为 title 作为 Json 字符串中的键,但没有成功。我获取了现有项目并尝试添加准确的 json 字符串,但仍然没有成功。我也试过下面的 json 数据但没有任何运气

'columnVals': json.dumps({
            'cloud_name6': cloudname
        })

知道查询有什么问题吗?

【问题讨论】:

    标签: api automation graphql monday.com


    【解决方案1】:

    通过项目查询创建或更改标签列时,您需要发送一个数组标签的id(“tag_ids”)与此项目相关。您不会通过项目查询设置或更改标签名称。

    更正代码

    'columnVals': json.dumps({
            'cloud_name6': {'tag_ids': [295026,295064]}
        })
    

    https://developer.monday.com/api-reference/docs/tags

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-21
      • 2011-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多