REST implementation

Topics: Developer Forum, User Forum
Jul 22, 2013 at 9:34 AM
Edited Jul 22, 2013 at 9:36 AM
How is the REST actually done in ActiveVFP?

I know I simply add a controller into the prg/rest/controllers folder but is the main handler part of the ActiveVFP.DLL?

This may be more of a basic ASP.Net question but I'm trying to confirm if the implementation requires that the controllers be in prg/rest/controllers.

Also, how do you handle further parameters such as http://localhost/customers/001/edit or
http://localhost/controller/edit/custnumber?

Reason I ask is that I was trying a
 PROCEDURE list
 LOCAL lc
 FOR lni = 1 TO ALEN(THIS.params,1)
    lc = lc + THIS.params(lni)+"<p/>"
 ENDFOR
 RETURN lc
 ENDPROC
And it is giving me an error of THIS.params does not exist.

Thanks

Andrew
Coordinator
Jul 22, 2013 at 8:32 PM
Edited Jul 22, 2013 at 8:33 PM
Andrew,

Check out:

https://activevfp.codeplex.com/SourceControl/latest#avfp6.03_source/prg/resthelper.prg
and
https://activevfp.codeplex.com/SourceControl/latest#avfp6.03_source/prg/dch.prg

These are in the activevfp.dll and allow you to simply write a controller in a prg.

The demos are on this page:

http://68.100.149.95:444/avfp6/customers


BTW, I'm pretty positive this can be improved upon in many ways but it's a good start!
Jul 24, 2013 at 9:43 AM
I'm writing my own REST handlers so that's not an issue...it's more of the initial parameters. I'll take a look at the items in there and see what can be found out.