How to pass headers to APIs from Swagger-UI?

256 views
Skip to first unread message

Arun Avanathan

unread,
Jul 13, 2014, 11:54:19 PM7/13/14
to swagger-sw...@googlegroups.com
I need to pass headers to my APIs from Swagger-UI. Is there a way to achieve that? I saw few references to modify index.html, but that solution doesn't work for me as these are dynamic headers which I need to modify with every API call.

Any help is appreciated.

Thanks

Ron

unread,
Jul 14, 2014, 6:43:23 AM7/14/14
to swagger-sw...@googlegroups.com
Arun,

Can you tell me more about these headers and what they serve?
If they are part of the API call, they should be described as header parameters for the operation and that would allow the user to define and execute the calls with them.
If not, there's probably a way to support it by modifying the html/js, but I'd need more information first.



--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arun Avanathan

unread,
Jul 15, 2014, 3:28:03 AM7/15/14
to swagger-sw...@googlegroups.com
Ron,

Firstly, thanks for quick response.

I was able to get the generic header by modifying index.html of SwaggerUI.

There are few API specific headers. For eg. If-None-Match header in  all GET APIs. 

@HeaderParam works great. However, to mitigate the code changes & keep the code modular I tried @BeanParam. Looks like it is not working. I have opened a bug giving all the details - https://github.com/wordnik/swagger-core/issues/618

Let me know if you need more information.

Thanks
Arun
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron

unread,
Jul 15, 2014, 3:34:18 AM7/15/14
to swagger-sw...@googlegroups.com
Yeah, let me reply the issue.


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages