Remus Avram Posted July 20, 2016 Report Share Posted July 20, 2016 Hi all, is there a way to get all 'custom attributes' from Ftrack using the API? Cheers, Remus Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted July 21, 2016 Report Share Posted July 21, 2016 Hi Remus, yes you can query for them like this: >>> import ftrack_api >>> session = ftrack_api.Session() >>> session.query('CustomAttributeConfiguration').all() Link to comment Share on other sites More sharing options...
Remus Avram Posted July 21, 2016 Author Report Share Posted July 21, 2016 Thanks! Works! I wasn't 100% sure if it;s the right type. Link to comment Share on other sites More sharing options...
Remus Avram Posted July 22, 2016 Author Report Share Posted July 22, 2016 I am trying to create a custom attribute but I am getting an error regarding permissions value: cmd: session.create('CustomAttributeConfiguration', { "key": name, "label": label, "attribute_type": attribute_type, "default": default_value, "entity_type": entity_type, "is_hierarchical": is_hierarchical, }, ) Error: # (MainThread)|Server reported error: OperationalError((OperationalError) (1048, "Column 'permissionid' cannot be null") 'INSERT INTO variable_register (id, `key`, entity_type, object_type_id, core, label, sort, type_id, permissionid, write_permissionid, is_hierarchical, config, project_id, `default`, groupid) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' (u'17885cf8-89fa-4e03-89b2-a696906ec7ea', 'test_custom attribute', 'task', None, 0, 'test_custom_att', 0, None, None, None, 0, None, None, '1', None)) Unfortunately, there is no 'permissionid' in the custom attribute keys. Current keys: """ sort core key entity_type default type type_id label is_hierarchical values object_type_id project_id config id """ Could you please post an example of creating a new custom attribute using the API? Link to comment Share on other sites More sharing options...
Björn Rydahl Posted July 25, 2016 Report Share Posted July 25, 2016 Hi Remus, it is currently not possible to create custom attributes via the API. You would need to create it via settings in the UI, and then use it from the API. Kind regards Link to comment Share on other sites More sharing options...
Remus Avram Posted July 25, 2016 Author Report Share Posted July 25, 2016 Hi Bjoern, thank you for your answer! Is there any plan for the future that this will be implemented in the API? Kind Regards Link to comment Share on other sites More sharing options...
Martin Pengelly-Phillips Posted July 27, 2016 Report Share Posted July 27, 2016 We'd also benefit from being able to manage custom attributes through the API. Link to comment Share on other sites More sharing options...
instinct-vfx Posted July 29, 2016 Report Share Posted July 29, 2016 +1 Link to comment Share on other sites More sharing options...
Björn Rydahl Posted July 29, 2016 Report Share Posted July 29, 2016 Thanks for the feedback everyone. I will discuss with the team and see if this is something we could add. Cheers Link to comment Share on other sites More sharing options...
kim-a Posted August 11, 2016 Report Share Posted August 11, 2016 What about querying for the contents of specific custom attributes? You cite the below example to return a list of all of the attributes. >>> session.query('CustomAttributeConfiguration').all() Does non-hierarchical in this situation mean that you can't go any deeper than the list of custom attributes? Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted August 12, 2016 Report Share Posted August 12, 2016 Quote What about querying for the contents of specific custom attributes? You cite the below example to return a list of all of the attributes. >>> session.query('CustomAttributeConfiguration').all() The code above is just about listing all available custom attributes in ftrack. The actual custom attribute values are easiest to access from the entities themselves. See this article: http://ftrack-python-api.rtd.ftrack.com/en/stable/example/custom_attribute.html A "hierarchical" custom attribute is a custom attribute that can exist on multiple levels in the hierarchy, see http://ftrack.rtd.ftrack.com/en/stable/administering/using_custom_attributes.html#hierarchical-attributes Link to comment Share on other sites More sharing options...
kim-a Posted August 12, 2016 Report Share Posted August 12, 2016 I realize that my post was not entirely clear--that's not what I want to query. I want to know what options are available to use for a particular custom field when creating a project. So let's say we have a custom field called "location" for projects, which is an enumerator type. I want to be able to create projects and set their locations in the process. In order to do this, I need to query what values exist in the location enumerator. I shouldn't be able to set a location for the project that doesn't exist. I also posted this question as a separate post here: Link to comment Share on other sites More sharing options...
Björn Rydahl Posted August 15, 2016 Report Share Posted August 15, 2016 Hi, I have responded via email but will write here in case someone else would like to know. You can query a configuration of a custom attribute and get the config for it: configuration = session.query( 'select config from CustomAttributeConfiguration where key is "YOUR-ATTRIBUTE-KEY"' ).one() print json.dumps(configuration['config']) Link to comment Share on other sites More sharing options...
laura.c Posted October 21, 2016 Report Share Posted October 21, 2016 Hi everyone! On 25.7.2016 at 9:28 AM, Björn Rydahl said: it is currently not possible to create custom attributes via the API. You would need to create it via settings in the UI, and then use it from the API. Is it somehow possible to add custom attributes to timelogs (via API or UI)? Thanks. Laura Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted October 21, 2016 Report Share Posted October 21, 2016 3 hours ago, laura.c said: Is it somehow possible to add custom attributes to timelogs (via API or UI)? I'm afraid not! It would be interesting to hear the use-case for this? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.