Example #1
0
 /**
  * Process HTTP PUT request
  *
  * @param array $segments
  */
 public function route($segments)
 {
     /*
      * Input data is mandatory for PUT request
      */
     $data = RestoUtil::readInputData($this->context->uploadDirectory);
     if (!is_array($data) || count($data) === 0) {
         RestoLogUtil::httpError(400);
     }
     switch ($segments[0]) {
         case 'collections':
             return $this->PUT_collections($segments, $data);
         case 'user':
             return $this->PUT_user($segments, $data);
         default:
             return $this->processModuleRoute($segments, $data);
     }
 }
Example #2
0
 /**
  * Process HTTP POST request
  * 
  * @param array $segments
  */
 public function route($segments)
 {
     /*
      * Input data for POST request
      */
     $data = RestoUtil::readInputData($this->context->uploadDirectory);
     switch ($segments[0]) {
         case 'api':
             return $this->POST_api($segments, $data);
         case 'collections':
             return $this->POST_collections($segments, $data);
         case 'user':
             return $this->POST_user($segments, $data);
         case 'users':
             return $this->POST_users($segments, $data);
         default:
             return $this->processModuleRoute($segments, $data);
     }
 }