ShotGrid API - How to create a new Version entity associated with a specific Shot using CLI?

Trying to create a Version in a specific Project associated with an existing Shot.

I got as far as associating the new Version with an existing Project. The following CLI works:

curl -X POST 'https://myproject.shotgrid.autodesk.com/api/v1/entity/_batch' \
-H 'Authorization: Bearer [activeToken]'
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d [See JSON below]

{
	"requests": [
		{
			"request_type": "create",
			"entity": "Version",
			"data": {
				"code": "Custom name here",
				"description": "Custom Description here",
				"sg_path_to_movie": "/Volumes/Path/To/File",
				"project": {
					"type": "Project",
					"id": 189
				}
			}
		}
	]
}

The challenge comes when trying to associate the new Version with an existing Shot.
What’s the syntax?

Adding the following to the above didn’t work:

shot: {  type: "Shot", id: 1549 }

Error is

{
   "errors": [
      {
         "id": "8779585553465e403ef0c49d134cefe1",
         "status": 400,
         "code": 104,
         "title": "Invalid field value, update failed [2 - Invalid field name: field [Version.shot] does not exist or user does not have access permission.]",
         "source": null,
         "detail": null,
         "meta": {
            "crud_error_uuid": "1aad7ab6-63b5-11ec-9165-0242ac110009"
         }
      }
   ]
}

Hi @Cmq ,

The problem that you encounter is caused by a wrong field-name. The link field for a Shot entity is by default named: entity

If you use entity: { type: "Shot", id: 1549 } instead, it should start working.

1 Like

@mminsel
I had suspected that, based on the data returned for Reviews, tested it and “proved” it “absolutely, positively, no doubt about it, does not work”

But of course after trying again based on your comment, it works perfectly. Thank you!