Forum Discussion

djslinger77's avatar
djslinger77
Occasional Visitor
7 years ago
Solved

Can not export definition from swaggerhub to inspector

I have created a simple POST request to my existing API. Then made a definition: https://app.swaggerhub.com/apis/just_comp/default-titlehhh/0.1-oas3 

Now i want to import this definition back to the inspector. I pasted the same link but instead of getting all me methods mocking up in the inspector, i am getting the html page response in the window. 

 

The default example works just fine as shown below:

 

I have tried to export json from swaggerhub then import it to the inspector - does not work. All fields are empty or filled wrong. It seems like i can make a definition in swaggerhun but it is impossible to import it back and test. 

  • Hi djslinger77,

     

    To access the raw definition, replace app with api in the address of your API:

    https://api.swaggerhub.com/apis/just_comp/default-titlehhh/0.1-oas3

     

    However, it looks like your API is private. Importing private definitions is tricky because they require an API key to access them. You can use one of the following approaches:

     

    1) Download the resolved definition from SwaggerHub, then use the Use Definition > File Upload button in Inspector.

     

    2) Use an API key to load your definition. First, copy your SwaggerHub API key from your profile: https://app.swaggerhub.com/settings/profile. Then, in Inspector, add this header to your definition request:

    Authorization: <YOUR_TOKEN>

    Inspector should be able to load your definition now.

1 Reply

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi djslinger77,

     

    To access the raw definition, replace app with api in the address of your API:

    https://api.swaggerhub.com/apis/just_comp/default-titlehhh/0.1-oas3

     

    However, it looks like your API is private. Importing private definitions is tricky because they require an API key to access them. You can use one of the following approaches:

     

    1) Download the resolved definition from SwaggerHub, then use the Use Definition > File Upload button in Inspector.

     

    2) Use an API key to load your definition. First, copy your SwaggerHub API key from your profile: https://app.swaggerhub.com/settings/profile. Then, in Inspector, add this header to your definition request:

    Authorization: <YOUR_TOKEN>

    Inspector should be able to load your definition now.