Referencing custom attributes in web services api post
This might be more of a json question -
To create a new ticket via web services workflow & specify a value for a certain custom attribute, how does one reference the attribute in the post? The posts work fine, except that the custom attribute info doesn't get into the new ticket.
Here's an example with fake info:
making a post to https://app.teamdynamix.com/SBTDWebApi/api/{appid}/tickets
{
"TypeID":11221,
"Classification":46,
"Title":"Project Approved: {{OrigTitle}}",
"Description":",
"AccountID":31111,
"SourceID":811,
"StatusID":1221,
"PriorityID":1414,
"RequestorName":"{{OrigRequestorName}}",
"RequestorEmail":"{{OrigRequestorEmail}}",
"Attributes.12345":"{{OrigReasonForRequest}}",
"ResponsibleGroupID":4141,
}
... where I'm trying to reference custom attribute with id "12345" in the 3rd line from the bottom. I've tried several different syntaxes for that line and have referenced the docs at https://api.teamdynamix.com/TDWebApi/Home/type/TeamDynamix.Api.Tickets.Ticket , but I don't seem to have it right.
Answers (2)
Hi David,
Sorry for the delay in getting back to you on this but we were working through the proper syntax to include a custom attribute array in your ticket update call.
So the Attributes section should be a JSON list that would look something like this (all values are purely for example, replace with your own values if you test with this):
"Attributes":[{"Name":"NameOfYourAttribute", "Order":"5","ID":"1278", "Value":"3778"}]
I don't think "Order" particularly matters, but it says that it is a required property. You could try excluding it I suppose if you wanted to test. You *do* need ID which is the ID of that custom attribute, and "Value" in this case was the ID of a choice option on a dropdown attribute. That could be text if your attribute is just a text attribute.
Let me know if this helps.
Sincerely,
Mark Sayers
TD Support
Thank you, that does the trick! Someone on our web team got me to the same solution just now (because I hadn't read your response yet), and it works.