Re: Is it possible to use data from the response header to a POST in a subsequent GET?
Status: Alpha
Brought to you by:
coroberti
From: Gary F. <ga...@in...> - 2008-10-02 20:28:50
|
> Where exactly is the text you need to grab? I an header or > in body. Please, a bit more details. I'd like to do two things. Both involve constructing client-specific URLS. If the second is too hard, I could probably make do with the first. 1. Client-specific urls built from tokens in a file. For example, here's some possible syntax for the configuration file: URL=http://a.xyz.com/users/%s/profiles/%s/subscriptions URL_TOKEN_FILE=foo In this case, each client would take two tokens from foo and use them to build the client-specific URL. Or, it might be simpler to build a file of complete client-specific URLs in advance, and take whole URLs from the file. Maybe that could look like this in the config file: URL=file("foo") 2. Build client-specific URLs from tokens returned in the body of previous responses. For instance, here's a sample client-server exchange (with most headers omitted): POST /login HTTP/1.1 login=gu...@in...&password=guest HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <user user_id="38" profile_id="3"/> PUT /users/38/profiles/3/subscriptions HTTP/1.1 stuff ... In this case I'd like to be able to grab user_id and profile_id from the returned XML, and use these tokens to build the subsequent URL. Maybe the config file could look something like this: URL=http://a.xyz.com/login RESPONSE_TOKEN=user_id RESPONSE_TOKEN= profile_id URL=http://a.xyz.com/users/<user_id>/profiles/<profile_id>/subscriptions I realize that it would be hard to make this completely general, but I'm sure I could write response-parsing code specific to my needs. Any guidance would be appreciated! Gary On Oct 2, 2008, at 11:28 AM, Robert Iakobashvili wrote: > Hi Gary, > > On Thu, Oct 2, 2008 at 9:16 PM, Gary Fitts <ga...@in...> > wrote: >> Hello list, >> There seems to have been no followup to this post from last >> November. I have a similar need, I know C and I'm willing to >> write a patch. Has anyone tried something similar? > > Where exactly is the text you need to grab? I an header or > in body. Please, a bit more details. > >> Any guidance? > > I will guide you. > >> Thanks, >> Gary Fitts |