Forum Discussion

srgmat's avatar
srgmat
Occasional Contributor
5 years ago

What is benefit of virtserver.swaggerhub.com - GET ?

Hello,

I am a first time user of app.swaggerhub.com and I noticed something

Server0 = virtserver.swaggerhub.com.*

Server1 = my own server

 

When I user Server0 to click on GET I get something like this:

[
  {
    "response": {
      "source": "string",
      "path": "string",
      "name": "string",
      "size": 0,
      "sha": "string",
      "html_url": "string"
    }
  }
]

What is the benefit of that GET Service?

 

Server1 (mine) does not return any array bracket characters [  ]

 

Neither does section Schemas indicate any arrays

    • srgmat's avatar
      srgmat
      Occasional Contributor

      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-savage's avatar
        alex-savage
        Occasional 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