Adding variables to 1.6 via script

Is there any way for me to add a slew of variables to 20+ projects in octopus via Script/API calls?

i’m assuming i can repost a document to the 1.6 api. for my variable additions right?

where the results of the query above are a json document I just construct this:

leaving the ID blank right? so like other posts i fill in the name, value and octpus will do the rest… is that a correct assumption
“Id”: “”,
“Name”: “temp”,
“Value”: “temp2”,
“ProjectId”: “projects-385”,
“Role”: null,
“EnvironmentId”: “DeploymentEnvironments-356”,
“StepId”: null,
“Links”: {
“Self”: “/api/projects/projects-385/variables/e4ac9755-d5fe-4828-bd0d-b58daa2f7576”,
“Project”: “/api/projects/projects-385”,
“Environment”: “/api/environments/DeploymentEnvironments-356”
“IsEditable”: true,
“IsVisible”: true

Hi Thom,

That’s correct - we have a blog post here with an example: