Page 1 of 1

Custom REST interface: Can the URL parameter "id" be used?

Posted: Sun Apr 28, 2013 5:14 am
by drmikecrowe
Hi folks,

I was experimenting with adding a REST interface to cmsms, and found that "id" can't be used, since it is used by cmsms.

NOTE: I'm implementing this in a quick/dirty manner, by:
  • I'm setting the template to simply: "{process_pagedata}{content}"
  • I'm using a UDT to read the _GET/_REQUEST parameters and process it
When I include an "id=XXXXX" parameter in my request, cmsms (of course) tries to use it, and the page won't load at all.

Any suggestions of how to work around this? And for the record, changing "id" isn't an option (the system that will use this has defined that parameter already).

If I wrote this into a module, could I accept an "id" parameter?

TIA

Re: Custom REST interface: Can the URL parameter "id" be us

Posted: Sun Apr 28, 2013 1:35 pm
by calguy1000
CMSMS has defined and used that parameter already.
You cannot use 'id' from $_GET or $_POST. Sorry.

I've removed it for CMSMS 2.0 but that won't help you now.

Re: Custom REST interface: Can the URL parameter "id" be us

Posted: Sun Apr 28, 2013 1:45 pm
by drmikecrowe
I was afraid of that.

Thanks, calguy.

Re: Custom REST interface: Can the URL parameter "id" be us

Posted: Wed May 08, 2013 2:39 am
by drmikecrowe
For anyone else who must do this

(warning, hack follows)

In your .htaccess, you can do:

Code: Select all

RewriteCond %{REQUEST_URI} ^/postback [NC]
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^(.+)$ index.php?page=postback?srid=%1 [L]
Looks simple, but took hours to perfect....