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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
drmikecrowe
Forum Members
Forum Members
Posts: 23
Joined: Sun Sep 20, 2009 1:22 pm

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

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

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

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
drmikecrowe
Forum Members
Forum Members
Posts: 23
Joined: Sun Sep 20, 2009 1:22 pm

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

Post by drmikecrowe »

I was afraid of that.

Thanks, calguy.
drmikecrowe
Forum Members
Forum Members
Posts: 23
Joined: Sun Sep 20, 2009 1:22 pm

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

Post 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....
Post Reply

Return to “Developers Discussion”