I stumbled upon an unexpected behavior while using the rest API to create a new landscape environment.
How to reproduce:
1- I create an environment like this:
curl -u %ccUser%:%ccPassword% -X POST http://%ccServerHostname%:%ccServerPort%/cce/landscape/environments -d “alias=%ccEnv%”
2- I assign an installation to this environment (using UI or REST, the result is the same)
3- I execute the same REST command as step #1 to create the same environment again. Then instead of telling me that the environment already exists, it will delete the association made in step #2. In fact all associations previously made for this environment will all be lost as well.
This causes me a problem because I have a script that installs/configures an IS and creates everything it needs, and one of the first step is to create an environment in CC, then associate the new installation with the environment. The first time I run it it works fine. But if I run it again I will lose the previous association.
Is this behavior by design or is it a bug? (or maybe I’m not using the API correctly)
Thanks.