/** * Update a resource that is already in existence by providing a new ResourceDescriptor defining the object at the URI provided. * * @param string $path - The path to the resource you wish to change * @param ResourceDescriptor $rd - a ResourceDescriptor object that correlates to the object you wish to modify (with the changes) * @param string $file - full file path to the image you wish to upload * @throws RESTRequestException * @return bool - based on success of function */ public function postResource($path, ResourceDescriptor $rd, $file = null) { $url = $this->restUrl . '/resource' . $path; $statusCode = null; if (!empty($file)) { $data = $this->multipartRequestSend($url, 200, 'POST_MP', $rd->toXML(), array($rd->getUriString(), $file), true); $statusCode = $data[0]; } else { $data = $this->prepAndSend($url, array(200), 'POST', $rd->toXML(), null, true); if ($data) { return true; } } if ($statusCode !== 200) { throw new RESTRequestException('Unexpected HTTP code returned: ' . $statusCode); } else { return true; } return false; }