Adding variables using REST API


I am trying to add variables in the newly created project using Rest API. Before that I want to create a project using the API which I unable to create using the below playbook. The same is happening with curl command. Is there other way I add the variables ( project > variables > project/project templates) using API?

  • hosts: localhost
    - name: view all the octopus projects.
    url: http://{ip-address}/api
    API_key: {API KEY}
    force_basic_auth: yes
    method: POST
    status_code: 200
    create-project: name=newProj projectgroup=nova environment=Nova2
    register: p
    - debug: var=p

Thank you!

Hi Siya,

Thanks for getting in touch!

The easiest way to interact with the API is using our octopus.client as this allows scripts to be used without needing to generate the full REST call.

We have a repository full of script examples for both the octopus.client and REST here:

For example, this script allows you to add or modify a variable within a specific project

I hope this helps, please let me know if you have any further questions.

Best regards,