Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-11

secure REST client?

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

waldo kitty

i'm looking at creating a REST web application client... nothing fancy... command line oriented... fire it up, it logs into the website and performs the REST queries saving the output to named files...

i have no clue where to start looking in the FPC documentation or any existing libraries... i have toyed with something using fpweb that would pull some pages from a site for scraping but that idea is no longer being considered...

firstly i'm not sure how to go about doing the login ops with cookies and such... the site gives some assistance and examples for using wget and curl but i think i'd prefer to handle this in my client... currently there's a "normal" login on an existing non-REST site and then there's a new method of login on the REST site... i haven't been able to figure out how to convert my fpweb client so that it properly logs in and retains the login so that subsequent queries will work...

this is extremely new territory for me coming from TP6/7...

help?

Michael Van Canneyt
to waldo kitty
waldo kitty wrote 9 lines
i'm looking at creating a REST web application client... nothing fancy... command line oriented... fire it up, it logs into the website and performs the REST queries saving the output to named files... i have no clue where to start looking in the FPC documentation or any existing libraries... i have toyed with something using fpweb that would pull some pages from a site for scraping but that idea is no longer being considered...

Why not ?

Show quoted text 8 lines
firstly i'm not sure how to go about doing the login ops with cookies and such... the site gives some assistance and examples for using wget and curl but i think i'd prefer to handle this in my client... currently there's a "normal" login on an existing non-REST site and then there's a new method of login on the REST site... i haven't been able to figure out how to convert my fpweb client so that it properly logs in and retains the login so that subsequent queries will work...

I have done this in several projects using fpweb (specifically fphttpclient). Usually it is simply a matter of retaining some cookies.

if you give more details, maybe I can offer more help ?

Michael.

waldo kitty
to Michael Van Canneyt
Michael Van Canneyt wrote 14 lines
On Thu, 8 Nov 2012, waldo kitty wrote: > > i'm looking at creating a REST web application client... nothing fancy... > command line oriented... fire it up, it logs into the website and performs the > REST queries saving the output to named files... > > i have no clue where to start looking in the FPC documentation or any existing > libraries... i have toyed with something using fpweb that would pull some > pages from a site for scraping but that idea is no longer being considered... Why not ?

mainly because the data is better gathered from the other site with REST... no need to screenscrape from there or have to deal with a lack of data because the 1st site hasn't gathered it ;)

Show quoted text 10 lines
> firstly i'm not sure how to go about doing the login ops with cookies and > such... the site gives some assistance and examples for using wget and curl > but i think i'd prefer to handle this in my client... currently there's a > "normal" login on an existing non-REST site and then there's a new method of > login on the REST site... i haven't been able to figure out how to convert my > fpweb client so that it properly logs in and retains the login so that > subsequent queries will work... I have done this in several projects using fpweb (specifically fphttpclient). Usually it is simply a matter of retaining some cookies.

you should recall my recent foray into using that code... i had asked about persistent connections because mine weren't completing until i included headers to state the connection was to be closed...

if you give more details, maybe I can offer more help ?

i'm not sure what to give... i have no clue how to gather cookie data and send it back based on the existing example(s) that i've seen :(

i do know that i was unable to use the REST site's sample wget cookie stuff make requests to the "normal" login site... i don't know how to state that properly since i'm not sure how either site is really working in this aspect... i only know that the cookie stuff apparently didn't work as described by simply changing the site address from one to the other...

Виктор Матузенко
to waldo kitty

Ккк
09.11.2012 7:12 пользователь "waldo kitty"

Show quoted text 62 lines
On 11/8/2012 17:11, Michael Van Canneyt wrote: > > > On Thu, 8 Nov 2012, waldo kitty wrote: > > >> i'm looking at creating a REST web application client... nothing fancy... >> command line oriented... fire it up, it logs into the website and >> performs the >> REST queries saving the output to named files... >> >> i have no clue where to start looking in the FPC documentation or any >> existing >> libraries... i have toyed with something using fpweb that would pull some >> pages from a site for scraping but that idea is no longer being >> considered... >> > > Why not ? > mainly because the data is better gathered from the other site with REST... no need to screenscrape from there or have to deal with a lack of data because the 1st site hasn't gathered it ;) firstly i'm not sure how to go about doing the login ops with cookies and >> such... the site gives some assistance and examples for using wget and >> curl >> but i think i'd prefer to handle this in my client... currently there's a >> "normal" login on an existing non-REST site and then there's a new >> method of >> login on the REST site... i haven't been able to figure out how to >> convert my >> fpweb client so that it properly logs in and retains the login so that >> subsequent queries will work... >> > > I have done this in several projects using fpweb (specifically > fphttpclient). > Usually it is simply a matter of retaining some cookies. > you should recall my recent foray into using that code... i had asked about persistent connections because mine weren't completing until i included headers to state the connection was to be closed... if you give more details, maybe I can offer more help ? > i'm not sure what to give... i have no clue how to gather cookie data and send it back based on the existing example(s) that i've seen :( i do know that i was unable to use the REST site's sample wget cookie stuff make requests to the "normal" login site... i don't know how to state that properly since i'm not sure how either site is really working in this aspect... i only know that the cookie stuff apparently didn't work as described by simply changing the site address from one to the other... ______________________________**_________________ fpc-pascal maillist - http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
Michael Van Canneyt
to waldo kitty: mainly because the data is better gathered from the other site with REST... no need to…
waldo kitty wrote 25 lines
>> "normal" login on an existing non-REST site and then there's a new method >> of >> login on the REST site... i haven't been able to figure out how to convert >> my >> fpweb client so that it properly logs in and retains the login so that >> subsequent queries will work... > > I have done this in several projects using fpweb (specifically > fphttpclient). > Usually it is simply a matter of retaining some cookies. you should recall my recent foray into using that code... i had asked about persistent connections because mine weren't completing until i included headers to state the connection was to be closed... > if you give more details, maybe I can offer more help ? i'm not sure what to give... i have no clue how to gather cookie data and send it back based on the existing example(s) that i've seen :( i do know that i was unable to use the REST site's sample wget cookie stuff make requests to the "normal" login site... i don't know how to state that properly since i'm not sure how either site is really working in this aspect... i only know that the cookie stuff apparently didn't work as described by simply changing the site address from one to the other...

Without more details, it is hard to give advice.
I can only say that I do something similar to what you describe with fphttpclient. If the persistent connection is a problem, you can try synapses httpsend class.

Michael.