Avoid automatically following 303 redirect (asynchronous API)

866 views
Skip to first unread message

cortez

unread,
Nov 11, 2013, 2:58:31 AM11/11/13
to swagger-sw...@googlegroups.com
Hi,

I have an asynchronous REST API that closely follows the design outlined here and here. So I have three methods set out like this:

POST /v1/foo (returns "202 Accepted")
GET /v1/foo/queue/{uuid}  (returns "200 OK" whilst job is pending, then "303 See Other" on completion) 
GET  /v1/foo/{uuid} (returns "200 OK" and the JSON result)

My question is: how can I prevent an actual redirect on the queue request? Most clients have some functionality to disable automatic following of redirects. I think I probably do want to do this, since it doesn't seem to make sense for the UI listing to display the response from another method. I couldn't find any option within Swagger UI, so perhaps there is something in Swagger JS (or even shred)?

(I am also tempted to ask whether this is slightly too complex a design... although it seems to be the correct RESTful way to do this).

Thanks,
Christopher 

tony tam

unread,
Nov 11, 2013, 11:29:38 AM11/11/13
to swagger-sw...@googlegroups.com
Are you talking about catching 303 in swagger-ui or in other clients?  If in swagger-ui, it's pretty simple to support in swagger-js:


You would add a handler for 303: just like the others.

Christopher Melen

unread,
Nov 11, 2013, 12:46:29 PM11/11/13
to swagger-sw...@googlegroups.com
Thanks Tony. Basically what I want to do is avoid Swagger UI following the redirect. I guess most clients have a flag or parameter which can be set to either enable or disable this (for example curl, where it has to be explicitly enabled).


Date: Mon, 11 Nov 2013 08:29:38 -0800
From: feh...@gmail.com
To: swagger-sw...@googlegroups.com
Subject: Re: Avoid automatically following 303 redirect (asynchronous API)
--
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/0bdVOOlH5XE/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/groups/opt_out.

tony tam

unread,
Dec 2, 2013, 11:10:26 AM12/2/13
to swagger-sw...@googlegroups.com
Did you try the technique I referenced?
To unsubscribe from this group and all its topics, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages