# password of your Rambla user account
require_once 'raws_json/json_client.php';
require_once 'raws_json/rats_service.php';
try {
    $rats = new RatsService(USER, PWD);
    # INPUT
    # -----
    # create input profile
    $input = $rats->createInput(array("name" => "test_rats_api_input", "method" => "cdn"));
    echo "\n\nCreated input: " . $input->entry->id;
    # retrieve a single input instance based on the id
    $input = $rats->getInputInstance($input->entry->content->params->id);
    echo "\nRetrieved input with name = " . $input->entry->content->params->name . " and method = " . $input->entry->content->params->method;
    # update input instance
    $input->entry->content->params->description = "Importing files from CDN";
    $input = $rats->updateInput($input);
    echo "\nRetrieved input with name = " . $input->entry->content->params->name . " and description = " . $input->entry->content->params->description;
    # get list of your own input instances
    echo "\nGetting list of my input profiles:";
    $input_list = $rats->getInputList("owner=self");
    foreach ($input_list->feed->entry as $e) {
        echo "\n Input has name = " . $e->content->params->name;
    }
    # delete input instance
    $rats->deleteInput($input->entry->content->params->id);
    echo "\nDeleted input with name = " . $input->entry->content->params->name;
    # OUTPUT
    # -----
    # create output profile
    $output = $rats->createOutput(array("name" => "test_rats_api_output", "method" => "cdn"));
    echo "\n\nCreated output: " . $output->entry->id;