public function post($data, $path = null) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    if(!isset($data) || (!is_string($data) && !is_object($data) && !is_array($data))) {
      throw new SagException('post() needs an object for data.');
    }

    if(!is_string($data)) {
      $data = json_encode($data);
    }

    if(is_string($path) && !empty($path)) {
      if ($path[0] === '/') {
        $path = '/'.urlencode(substr($path, 1));
      } else {
        $path = '/'.urlencode($path);
      }
    }
    else if(isset($path)) {
      throw new SagException('post() needs a string for a path.');
    }

    return $this->procPacket('POST', "/{$this->db}{$path}", $data);
  }
public function post($data, $path = null) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    if(!isset($data) || (!is_string($data) && !is_object($data) && !is_array($data))) {
      throw new SagException('post() needs an object for data.');
    }

    if(!is_string($data)) {
      $data = json_encode($data);
    }

    if(is_string($path) && !empty($path)) {
      if ($path[0] === '/') {
        $path = '/'.urlencode(substr($path, 1));
      } else {
        $path = '/'.urlencode($path);
      }
    }
    else if(isset($path)) {
      throw new SagException('post() needs a string for a path.');
    }

    return $this->procPacket('POST', "/{$this->db}{$path}", $data);
  }
public function post ( $ data , $ path = null ) { if ( ! $ this -> db ) { throw new SagException ( 'No database specified' ) ; } if ( ! isset ( $ data ) || ( ! is_string ( $ data ) && ! is_object ( $ data ) && ! is_array ( $ data ) ) ) { throw new SagException ( 'post() needs an object for data.' ) ; } if ( ! is_string ( $ data ) ) { $ data = json_encode ( $ data ) ; } if ( is_string ( $ path ) && ! empty ( $ path ) ) { if ( $ path [ 0 ] === '/' ) { $ path = '/' . urlencode ( substr ( $ path , 1 ) ) ; } else { $ path = '/' . urlencode ( $ path ) ; } } else if ( isset ( $ path ) ) { throw new SagException ( 'post() needs a string for a path.' ) ; } return $ this -> procPacket ( 'POST' , "/{$this->db}{$path}" , $ data ) ; }
POST's the provided document. When using a SagCache, the created document
and response are not cached.

@param mixed $data The document that you want created. Can be an object,
array, or string.
@param string $path Can be the path to a view or /all_docs. The database
will be prepended to the value.

@return mixed
POST s the provided document . When using a SagCache the created document and response are not cached .