Forum Discussion
Hi srgmat,
virtserver.swaggerhub.com is SwaggerHub's mock server, it generates static responses based on the information in your API definition. To learn more about how API mocking works, see:
https://app.swaggerhub.com/help/integrations/api-auto-mocking
I see. So if the response of the mockup is not the same than of the real service,
then either there is an error in the Specification or in the Implementation.
--> the error is most likely somewhere on my side, correct?
- alex-savage5 years agoOccasional Contributor
I mainly use the API mocking server for "API Design First" where I do not have an implementation and I want to use SwaggerHub to design and test and circulate the API definition before passing it to developers (Get consumers to review before you make the wrong thing!)
To get the benefits of the mocking server, you want to include examples with each of your properties. That way when the "Try It Out" button is used, you get back what looks like a real API response. Great for testing, use Postman, Curl or even your browser.
Examples:
You have an API definition that you want to return a list (Collection) of something. For example lets say Locations:
Your endpoint is going to be something like:
Then its going to need a schema that returns a list (Collection of resources) in an array
When you use the "Try It Out" you should see something like this
If your seeing an error make sure that the integration is enabled from the top left menu. I have seen that before where you get a 404 from the try it now button.
Click on the name of your API definition, then integrations and make sure that Auto Mocking is enabled
Good luck
Related Content
- 12 years ago
Recent Discussions
- 2 days ago
- 2 months ago