1

How is linking local files done thru the api?

I have been trying to achieve this using a modified set url method with no success:

sg.update("Shot",shot['id'],{'sg_proxy_clip':{'url':None,'name':'asset/proxies/shot_001.mov','content_type':None}})

it is returning a 'invalid/missing url hash string' error

4 comments

  • 0
    Avatar
    Tim BOWMAN

    I'm in the same boat -- trying to link a local file to a version using the same technique as you. 

    Our link field is named "sg_local_linx". I have a file linked to a version and when I do sg.find('Version', [ ['id','is',1309], ], ['id', 'code', 'sg_local_linx']), I get this:

    [{'code': 'AA_001_015_comp_v02',

      'id': 1309,

      'sg_local_linx': {'content_type': None,

                        'name': 'IANF_12475/_reference/100810_Dive_Tiffs/FB_0446B.tif',

                        'url': None},

      'type': 'Version'}]

    But when I look up the schema for "sg_local_linx", I get this:
    {'sg_local_linx': {'data_type': {'editable': False, 'value': 'url'},
                       'description': {'editable': True, 'value': ''},
                       'editable': {'editable': False, 'value': True},
                       'entity_type': {'editable': False, 'value': 'Version'},
                       'mandatory': {'editable': False, 'value': False},
                       'name': {'editable': True, 'value': 'local_linx'},
                       'properties': {'default_value': {'editable': False,
                                                        'value': None},
                                      'open_in_new_window': {'editable': True,
                                                             'value': True},
                                      'summary_default': {'editable': True,
                                                          'value': 'none'}}}}
    Shouldn't those match? Am I missing something? I'd appreciate any light anyone can shine in here... 'cause I'm pretty dim today.
    filters = [ ['id','is',1309], ]
        result = sg.find('Version',filters, ['id', 'code', 'sg_local_linx'])  
  • 0
    Avatar
    KP

    The support for local file linking via the Python API is coming soon... it's in QA right now and hoping it will be ready for release this coming weekend. Ideally in the future, API support for stuff like this will roll out in line with new features, but unfortunately this lagged behind as it needed some extra work to ensure we were supporting it correctly.

    When we release API features, we want to be doubly sure that the implementation is correct so that it will not have to change in the future. Any changes in the way features work in the API can potentially break scripts and cause a headache of refactoring time for devs so we felt it was better to try and get it right from the start rather than push anything out too quickly and possibly have to change it along the way. 

    So hang tight... we'll have it out asap.

  • 0
    Avatar
    Paul Hudson

    Has this been released yet?  Don't want to seem impatient, just checking! 

    Is there a release notes area for the API?

     

    Thanks,

    Paul

  • 0
    Avatar
    KP

    We released support for local file access via the API with Shotgun v2.2. You'll need a the newest version of the Python API.

    Python API: https://github.com/shotgunsoftware/python-api

    Docs: https://github.com/shotgunsoftware/python-api/wiki/Working-With-Local-Files

    Thanks for being patient... 

Please sign in to leave a comment.