I’m attempting to learn to use the Octopus API via the swaggerui and apparently I’m missing something.
Here’s what I’ve done:
Generated an API key in my profile.
Used the “Authorize” button on the swaggerui and entered the API key in all combinations of “X-Octopus-ApiKey” and “ApiKey”.
Used the “Execute” button in a number of “GET” calls of which I have permissions in my profile to access.
Here is the entirety of what I get in response:
Response Body
{
“ErrorMessage”: “The resource you requested was not found.”
}
Thanks for getting in touch. Are you able to share some specifics of which APIs you are trying to execute and what values you have tried?
I’ve just done some testing with the exact setup you described on the Projects Get endpoint and it returns the response you are seeing if I try an Id or Slug that doesn’t exist, but other than that it seems to be working as expected. I’m wondering if maybe it’s an issue with specific APIs.
I created a new API key this morning (the one I created yesterday was being reported as invalid … no idea about that, but …)
Then I tried Projects - /api/projects/{idOrSlug} with API key in the “ApiKey”/“X-Octopus-ApiKey”/both Authorization fields and with the following slug from a project that I created:
Self-Service
and each time received the following in the Response body:
{
“ErrorMessage”: “The API key you provided was not valid. Please double-check your API key and try again. For instructions on finding your API key, please visit: http://g.octopushq.com/ApiKey”,
“Errors”: []
}
Maybe this is progress from yesterday but … ? lol.
I’ve just rerun the test on 2018.8.4, based on the earlier message I assume that’s the version of Octopus you are running? Still worked as expected for me.
I only set the Api Key in X-Octopus-ApiKey, could you try just setting that one?
I’ve done as you suggested (using only the X-Octopus-ApiKey for authorization) and am still getting the same response with the key I generated yesterday.
I again generated a new key this morning and retried, yet still received the same response.
I looked to see if there was a permission for running either the API or the SwaggerUI version and haven’t stumbled across anything.
I guess I’m at the end of my ideas and understanding of what I need to get the SwaggerUI to bend to my will.
Are you available for a webex, I can set it up, the project that I’m intending to use this on is due tomorrow and I’d really rather not resort to a manually digging the Octopus UI for information.
You’re being an API guy, I’m sure you understand
Btw, here is an identifier I found on the SwaggerUI page, it’s likely not helpful but … meh:
That’s interesting that the portal and API are reporting different versions, they should be reporting the same number. This should only cause potential issues with the portal, not SwaggerUI.
Yes I can be available on a Webex/Zoom call if it still helps? I’m in Brisbane, so sorry for the timezone delay on this reply.
I’ve spoken with @Shannon_Lewis and agreed to jump on a call with you to discuss further as I am based in the UK. Do you have time this week to jump on a call with me and we can jump into the issue and hopefully find a fix for you? You can book some time here.
Thanks for your patience today, that really was a weird one.
As discussed, there was a couple of issues. Firstly, it looks like you were trying to authenticate to the demo instance of Octopus which explains the authorization failing.
The second issue was the use of a virtual directory. Swagger was displaying over the usual link i.e url.com/swagger but when running, it was running over the Virtual Directory which explains the constant errors. Once we figured that out, the API calls with the Octopus Client started working as expected.
Please let me know how you get on and if I can help further.