Hi,

On 2025/01/14 0:16, Greg H wrote:
> Anyone know how to set a version as "Default" (the default version for new 
> tickets) when creating or updating a version via XmlRpc API? There are 
> ticket.version.create and ticket.version.update methods that accept 
> 'attributes' so I'm guessing something can be passed in here to achieve this?

Try to omit "version" in the attributes parameter after setting default to one 
of versions in Manage Versions page.

[[[
$ cat body.json
{
    "id": 42,
    "method": "ticket.create",
    "params": [
        "summary",
        "description",
        {
            "type": "task",
            "priority": "minor"
        }
    ]
}

$ curl -s -u admin:password -H "Content-Type: application/json" \
       --data @body.json \
       http://192.168.11.122:3000/tracenv/login/rpc
{"result": 3, "error": null, "id": 42}

$ curl -s -u admin:password -H "Content-Type: application/json" \
       --data '{"method": "ticket.get", "params": [3]}' \
       http://192.168.11.122:3000/tracenv/login/rpc | jq -M
{
  "result": [
    3,
    {
      "__jsonclass__": [
        "datetime",
        "2025-01-18T20:48:52.485867"
      ]
    },
    {
      "__jsonclass__": [
        "datetime",
        "2025-01-18T20:48:52.485867"
      ]
    },
    {
      "summary": "summary",
      "reporter": "admin",
      "owner": "< default >",
      "description": "description",
      "type": "task",
      "status": "new",
      "priority": "minor",
      "milestone": "",
      "component": "",
      "version": "2.0",   # <== The default version is used
      "resolution": "",
      "keywords": "",
      "cc": "",
      "time": {
        "__jsonclass__": [
          "datetime",
          "2025-01-18T20:48:52.485867"
        ]
      },
      "changetime": {
        "__jsonclass__": [
          "datetime",
          "2025-01-18T20:48:52.485867"
        ]
      },
      "_ts": "1737233332485867"
    }
  ],
  "error": null,
  "id": null
}
]]]

-- 
Jun Omae <[email protected]> (大前 潤)

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/trac-users/c5d048e5-e846-4ca0-ba8f-9456f0ee92f6%40gmail.com.

Reply via email to