I need to update data in HP Quality Center with Drupal.
After login with success, I get some data from QC with the following code (simplified):
$headers = array('Cookie' => $cookie);
$request = drupal_http_request('http://qc.intra.xxx.com:8090/qcbin/rest/domains/' . $domainname . '/projects/' . $projectname . '/test-instances?query={cycle-id["' . $id . '"]}',
array('headers' => $headers),
'GET'
);
$xml = simplexml_load_string($request->data);
$json = json_encode($xml);
$testset_array = json_decode($json, TRUE);
What I want now is to update some QC fields. For that, instead of GET, I need PUT. The code I've tried to update a test instance:
$xml_data = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Entity Type="test-instance">
<Fields>
<Field Name="my_field">
<Value>my value</Value>
</Field>
</Fields>
</Entity>';
$headers = array('Cookie' => $cookie, 'content-type' => 'application/xml');
$url = 'http://qc.intra.xxx.com:8090/qcbin/rest/domains/' . $domainname . '/projects/' . $projectname . '/test-instances/404886';
$request = drupal_http_request($url,
array('headers' => $headers),
'PUT',
$data
);
$xml = simplexml_load_string($request->data);
$json = json_encode($xml);
$testset_array = json_decode($json, TRUE);
This is not working and I don't get any error also, what am I doing wrong?
Thanks