Custom Header for invocation of REST API via Swagger

77 views
Skip to first unread message

Aman Jain

unread,
Nov 11, 2015, 4:46:15 PM11/11/15
to Swagger
Hi,

Is there a way to identify in my REST API whether request has came from Swagger UI or any other source? In other words, can I check for any request parameters (header or query) in my REST API which tells me that request has come from Swagger?

If there is way where I can modify the CURL request from Swagger to always include a header parameter in its request which will indicate my REST API that call has been made from Swagger? Please let me know.

I need my REST API to route to non-production database when call is made from Swagger UI - while for all other calls, it should access production database.

Any help shall be greatly appreciated.

Thanks,
Aman

tony tam

unread,
Nov 12, 2015, 2:29:26 AM11/12/15
to swagger-sw...@googlegroups.com
You can use the request signing mechanism to change the URLs inside swagger-ui.  Read more here:


--
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.

Aman Jain

unread,
Nov 13, 2015, 6:55:29 PM11/13/15
to swagger-sw...@googlegroups.com
​Is there a way I can do this by changing curl statement in Swagger JS file? I have included Swagger JS files in my web application to enable Swagger UI that renders Swagger JSON. Please let me know.

Thanks,
Aman​

--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/7NGMACsS0xI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Aman
Reply all
Reply to author
Forward
0 new messages