Swaggerui returns on "ErrorMessage": "The resource you requested was not found."


(Mike) #1

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.”
}

Response Headers
content-security-policy: default-src ‘none’; connect-src ‘self’; font-src ‘self’; img-src data: https://www.gravatar.com ‘self’; script-src eval: inline: ‘self’ ‘unsafe-eval’ ‘unsafe-inline’; style-src inline: ‘self’ ‘unsafe-inline’; worker-src ‘self’; block-all-mixed-content; sandbox allow-same-origin allow-scripts allow-forms allow-popups allow-modals;
content-type: application/json; charset=utf-8
date: Tue, 12 Mar 2019 12:23:24 GMT
octopus-node: name=UT-DEPLOY-TEST; version=2018.8.4
referrer-policy: no-referrer
server: Microsoft-HTTPAPI/2.0
transfer-encoding: chunked
x-content-type-options: nosniff
x-frame-options: DENY
x-xss-protection: 1; mode=block

I also tried by copying the Curl and using that in the cmd window of my Windows 10 machine and receive the same Response body in return.

I googled for reasons and haven’t found a resolution.

Very appreciative of your help.


(Shannon Lewis) #3

Hi Mike,

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.

Regards
Shannon


(Mike) #4

Hi Shannon,
Thank you very much for your reply.

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.

If this wasn’t enough detail lmk :slight_smile:

Thank you,

Mike


(Shannon Lewis) #5

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?

Regards
Shannon


(Mike) #6

Hi Shannon,

Thank you again for your reply.

You are correct, our portal version is v2018.8.4.

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 :slight_smile:

Btw, here is an identifier I found on the SwaggerUI page, it’s likely not helpful but … meh:

2019.1.0+Branch.tags-2019.1.0.Sha.9e13a93e8c97d83f662327d90eb5712e62fd40df


(Shannon Lewis) #7

Hi Mike,

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.

Regards
Shannon


(Mike) #8

Hi Shannon,

Thanks for being open to a webex.

What is your next availability?
I realize it’d be Saturday for you tomorrow but I’ll make myself available at your next availability.

I wasn’t aware of the timezone you’re or I would have stayed up later last night :slight_smile:

Mike


(Derek Campbell) #9

Hi Mike,

Thanks for your patience on this.

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

Derek


(Derek Campbell) #12

Hi Mike,

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.

Thanks

Derek


(Mike) #13

Thanks Derek,

Pleasure working with you.

Mike

From:
“Derek Campbell
via Octopus Deploy” support@octopus.com

To:
michal.muller@alliedsolutions.net

Date:
03/18/2019 12:20 PM

Subject:
[Octopus Deploy]
[Support] Swaggerui returns on “ErrorMessage”: “The resource
you requested was not found.”