cancel
Showing results for 
Search instead for 
Did you mean: 

Swagger hub - auto mocking plugin doesn't work

SOLVED
Highlighted
New Contributor

Swagger hub - auto mocking plugin doesn't work

Hi,

I'm trying to generate auto mock for my API, but I have problem with that.

 

The mock should be available at:

https://virtserver.swaggerhub.com/{owner}/{api}/{version}

 I' m getting 404 for this page.

 

I can see an error in the Api panel:

 

Last updated:11:34:09 am Nov 10, 2017

SmartBear API Auto Mocking Plugin
Could not generate API mock. Error connecting to API mock VirtServer.

 

Does it work for you or is there a problem only in my project?

Ewelina

 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

The mock base URL is just the prefix for the operation paths. For example, to call GET /pet/1, you would use

https://virtserver.swaggerhub.com/ITT8/MOCK_TEST/1.0.0/pet/1

 

If you try out the operations in the UI, you will see their corresponding mock URLs in the curl examples.

 

The base URL itself will only return a response if you have an operation at the root path /, such as:

paths:
  /:
    get:
      ...

Hope this helps! We'll update the docs to clarify this.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

4 REPLIES 4
Highlighted
Moderator

Hi Ewelina,

 

Could you please post a link to your API so that the devs could have a look? Or if it's private, please share it with the swaggerhub-support user.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
New Contributor

Hi Helen,

I've created a public test API:

https://app.swaggerhub.com/apis/ITT8/MOCK_TEST/1.0.0

 

This base url:

https://virtserver.swaggerhub.com/ITT8/MOCK_TEST/1.0.0

returns 404 for me.

 

Maybe, I'm missing something in the project configuration. I will be grateful if you can give me any advice.

 

Ewelina

Moderator

The mock base URL is just the prefix for the operation paths. For example, to call GET /pet/1, you would use

https://virtserver.swaggerhub.com/ITT8/MOCK_TEST/1.0.0/pet/1

 

If you try out the operations in the UI, you will see their corresponding mock URLs in the curl examples.

 

The base URL itself will only return a response if you have an operation at the root path /, such as:

paths:
  /:
    get:
      ...

Hope this helps! We'll update the docs to clarify this.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

Highlighted
New Contributor

Thanks Helen. I don't know why, but I thought I would get the whole panel for testing like this:

http://petstore.swagger.io/#/

 

Still it's more than useful for me. Thank you for the quick reply. 

 

New Here?
Join us and watch the welcome video: