Importing Process Via API

Hi All,

I been experiencing a strange issue when trying to import a JSON file Via API for the Deployment process of a project. Just to give some context as I am fairly new to Octopus, we started to create a demo and created everything on runbooks and now we want to test with the deployment process. I could not find an easy way to clone the runbooks to a NEW project so I exported each runbook as JSON and tried to import via API. Only the First one worked (After removing IDs). So I tried to combine all the JSON into one Create a new project and Import, it did not work either. So I said ok Let me clone everything to the current Deployment Process of the same project, Export it’s JSON and import it in another project but still same result.

First of all it is VERY strange that on each project I can only PUT once via API, I do not know what is the reason but if I Import a JSON File via API, Delete all steps and try again to re-import same File, it returns Error 400 Bad Request as well so it is not something with the JSON itself it seems. Second thing that I found strange is the fact that I am downloading a process deployment export now directly from the server, and All I am doing is removing IDs but still same error.

Any ideas or solutions for importing such JSON ?

Thanks !

Hey there @andrew4 ! I’d like to know how about how you’re performing the export, are you doing this via API calls? If so, would you be able to paste and example?

Hi @Shawn_Sesna,

No, I actually am downloading them manually from the portal then use the file to import via API.

Ah, okay, thanks for clarifying :slight_smile: Have you had a look at https://github.com/OctopusDeployLabs/SpaceCloner? This is a script that was developed to copy projects from one space to another, but could be used to copy to the same space as well.

Hi @Shawn_Sesna, Thanks for your feedback, it does not have an option to copy to a different project (if I did not miss anything) but I will check the code to see if I can modify few things to cater to it. If there is this functionality already existing somewhere else or I missed it in the repo, please bring it to my attention :slight_smile: Thanks Again @Shawn_Sesna

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.