I am creating this YAML on http://playground.apistudio.io/b0ac1d44-630e-4ec5-827b-21930590a985/#/ But the try operation bit is not working .part of the reason is that my API is secured via an APpkey.How can I set a header and give it a predefined value ..i want to add this headers: Apikey: "55JIO0chabcdffGGCCK0fCYQ5phBAVd" Please suggest how to do this or an example will help |
Solved! Go to Solution.
You can use parameters object with default for the parameter as below.
parameters: - name: Apikey in: header description: API key required: false type: string format: string default: xxxx
Please find the updated swagger yaml attached with the answer.
You can use parameters object with default for the parameter as below.
parameters: - name: Apikey in: header description: API key required: false type: string format: string default: xxxx
Please find the updated swagger yaml attached with the answer.
@shweta agarwal , You can find details regarding swagger spec 2.0 here.
@Anil Sagar tahts exactly what I was looking for.
Thanks
Let’s say we want our API consumer’s to provide some informations about themselves by using the good old User-Agent
HTTP header (for tracking, debugging, or whatever you want).
We define the parameter just like any other one, we just need to set the header
value in in
:
And we use it (on every path) just like any other parameter:
There’s absolutely no way of telling once and for all that all operations needs this header parameter (for now).
nb: This works also with custom HTTP header.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |