Commit 863b5c0c authored by Mindiell's avatar Mindiell

Fake REST API in order to be able to work

parent ed7760e0
<?php
// Fake REST API from Campaign module
class RestApi {
function campaign($f3,$args) {
echo '{
"title": "Piphone Demo\'s campaign",
"description": "This is a demo campaign used to illustrate how the piphone works. This campaign does not grants you the possibility to contact anyone, it\'s just an ilustration of how it works.",
"start_date": "2014-01-01",
"end_date": "2014-12-31",
"default_language": "en"
}';
}
function contacts($f3,$args) {
// List of contacts
}
function contact($f3,$args) {
if ($f3->exists('PARAMS.contact')) {
// Specified contact
} else {
// Random contact
}
}
function groups($f3,$args) {
// List of groups available
}
function categories($f3,$args) {
// List of feedback categories
}
function feedback_add($f3,$args) {
// List of contacts
}
function arguments($f3,$args) {
// List of arguments
}
};
[routes]
; Main site
GET @home:/=Main->show
GET @home:/=Main->home
; Fake REST API
GET /restapi/campaign/@id=RestApi->campaign
GET /restapi/campaign/@id/contacts=RestApi->contacts
GET /restapi/campaign/@id/contact=RestApi->contact
GET /restapi/campaign/@id/contact/@contact=RestApi->contact
GET /restapi/campaign/@id/groups=RestApi->groups
GET /restapi/campaign/@id/feedback/categories=RestApi->categories
POST /restapi/campaign/@id/feedback/add=RestApi->feedback_add
GET /restapi/campaign/@id/arguments/@lang=RestApi->arguments
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment