Variables in Hubs
What
Inputting variables in API documentation whenever you consume them can quickly become a tedious time sink. The same pain point applies to people consuming your documentation. Inputting an API key everytime you want to send HTTP Requests to test endpoints is time better spent elsewhere. Stoplight removes this obstacle by storing variables in your local browser. Once you input a variable, it populates the rest of your docs, no duplication, no problems.
How
You can specify variables in your docs by adding them at the specification level or directly into Hubs.
Modeling Method
- Select the modeling file you wish to modify
- Create a new security scheme
- Input a key (required, must be unique in this specification)
- Select a type of security scheme
- Select a location for the security scheme under in
- Input a name
- Reference the specification in your Hub
Hubs Method
- Select the Hub you wish to modify
- Create a HTTP Request Maker block
- Select the Headers tab
- Click Add Header
- Input a header name
- Input a header value
Related