I am Prabhjot working on Octopus Deploy. I am trying to create release using REST API and it is working. Similarly trying to deploy particular release version on specific environment using REST API but getting error.
In the above mentioned command I am providing space I’d, project id, name, environment I’d, channel I’d, release I’d, version but still getting this error.
Please let me know if I am doing something wrong here. Thanks in advance.
Thanks for getting in touch! This type of error can suggest a few things, but the most common would be the API key being used may not have the the required permissions or scoping to access one of the resources.
You will need to confirm that the account for the supplied API key has the correct permissions to edit the resources that you’re trying to POST (project, space, environment, etc.). Once you confirm that the account has appropriate permissions configured, you can then check that the any scoping for the teams providing those permissions are not too restrictive.
For example, if a team assigned to the API key’s account provides
ProjectEdit, but is scoped to Spaces-1, and there are no other teams providing that permission, then the the account won’t have access to Spaces-2.
Let me know if this helps.
If you have any further questions or if it looks like the permissions for the API Key’s account should be working, please don’t hesitate to let me know.
Thanks for the reply. I am using default admin login and API key generated in my API Keys inside profile. I have used the same API key to create release and to show deployment details and it is working, but for create deploy it is showing this error.
Please let me know which option I am missing here.
Thank you for getting back to us.
Just to confirm, are you able to create a Deployment for the same Project/Environment/Target/Tenant combination in the Octopus UI while logged in as the user the API key was created against?
Let us know at your earliest convenience.
Thanks for the reply. I am sharing a screenshot where I am using the same API key and creating and environment named ggg. But weird thing is I have given space I’d as Spaces-62 but it has created environment in Spaces-1.
But the achievement is it has created the environment. Similarly I am trying to create deployment which I am not able to do. Please help me out
Thank you for getting back to me.
In looking at your screenshot, I can see that the URL you used for /api/environments has no Space specified.
Since you are using Spaces, you need to ensure that the URLs you POST against include the Space in the URL. Having the Space in the JSON isn’t enough in this case.
I highly recommend you check out our Swagger API tool that is built into Octopus via https://YOUR_OCTOPUS_URL/swaggerui. This shows all the built-in endpoints and allows you to test them as well after supplying your API key at the top-right of the page.
Let us know if you have any additional questions.
Thanks for the reply. Similarly I am trying to create deployment as well. I am adding some of the details but getting error as resource string was not found. Can you please help me out to understand which string it is referring to and what should I add more.
Thank you for getting back to me.
It looks like you have many parameters in the JSON that aren’t necessary. For instance, if you look at the dev tools for your browser when you Deploy a Release from the UI, you can see that only three parameters are used (EnvironmentID, ProjectID, and ReleaseID).
We also have an example of this in action in a simple PowerShell script. For an untenanted Deployment, only the ReleaseID and EnvironmentID are needed in the JSON body:
It looks like your URL is correct. Now you just need to only include the JSON parameters you are using and omit the rest.
Let me know if you are able to get this to work by only including the EnvironmentID and ReleaseID as parameters in your JSON.
Thanks alot. It is working and so simple than the swaggerui. It is very difficult to find out all the id’s for the particular resource in swaggerui.
Thanks once again
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.