Skip to content

Inject values into placeholders in Regions using REST interface

russellfeeed edited this page Apr 23, 2015 · 2 revisions

You can grab regions using the REST interface using

http://mycockpitdomain.com/rest/api/regions/get/my-region-name?token=09999429a523d1499990d44b&myplaceholder=abc123

And then in your region use

<?=$_GET['myplaceholder']?>

when you want to display it's value (abc123 in this case)

For example

http://mycockpitdomain.com/rest/api/regions/get/welcome?token=09999429a523d1499990d44b&firstname=John&town=Basingtoke

Where your 'welcome' Region template is

Hi <?=$_GET['firstname']?>,

Isn't <?=$_GET['town']?> a fantastic place to live!

would result in

Hi John

Isn't Basingstoke a fantastic place to live!`

And as the placeholder is just PHP you could perform calculations or anything you'd like.