Skip to content

Instantly share code, notes, and snippets.

@jotham
Created July 8, 2015 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jotham/4c59bd0e95ef5a52eebc to your computer and use it in GitHub Desktop.
Save jotham/4c59bd0e95ef5a52eebc to your computer and use it in GitHub Desktop.
<?PHP
class CampaignManager_API extends APIController {
...
public function getClients(){
return $this->success(array(
'ClientList' => array()
));
}
}
<?PHP
class APIController extends Controller {
...
public function success($data){
$response = new SS_HTTPResponse();
$response->addHeader('Content-Type', 'application/json');
$response->setBody(json_encode(array(
'success' => true,
'response' => $data
)));
return $response;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment