php - Watson Analytics - 返回格式错误

I am not quite sure if there was any recent updates on Watson Analytics APIs, but in fact my original code was working properly, I am now facing issues.

We've a function in php that built a variable named csv and then execute a curl to load it as specified into API Explorer, page. Follow how the code is:

function populateDataset_Internal($dsId, $segmentId, $strJsonColumns, $strLine){

$curl = curl_init();

$csv = $strJsonColumns;
$csv .= $strLine;

echo $csv;

curl_setopt_array($curl, array(
  CURLOPT_URL => "/data/v1/datasets/" . $dsId . "/content/" . $segmentId,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    curl_setopt($curl, CURLOPT_POSTFIELDS, $csv),
    //CURLOPT_POSTFIELDS => $csv,
    CURLOPT_HTTPHEADER => array(
    "accept: text/csv",
    "content-type: text/csv",
    "cache-control: no-cache",
    "authorization: Bearer " . $_SESSION["tokenl"],
    "x-ibm-client-id: " . $_SESSION["XIBMCLIENTID"],
    "x-ibm-client-secret: " . $_SESSION["XIBMCLIENTSECRET"]
  ),
));    

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);    

echo "populateDataset_Internal:" . $response . " - " . $err  ."<br/>";

return "";

}

the $csv contains txt/csv contents, such the example below:

FileType;Geography;Account;Industry;Sector;Name;DateStart;HourStart;HOUR(HourStart);DateEnd;HourEnd;HOUR(HourEnd);Status JOBType,Brazil;Beta;Financial;BANK;Test;02/02/2016;00;02/02/2016;01;Complete

This was smoothly working until the code be replaced into API Explorer. Since then, we started to receive malformed error. After exchanging some email with WA Team support they provided other source code, but the problem persists. The code is listed above.

Did someone face the same issue or even have an idea in what is going on ?

I reproduced the issue using Postman. You need to remove or update the Accept header. The API only ever returns application/json. I think enforcement of the Accept value was recently added, that is why it used to work and stopped. The returned payload is unacceptable, I will ask the team to fix this.

It also looks like the sample displayed in API Explorer is wrong.