Simplified version of setSettings: edits a mapping's symbols.
URL: https://www.trade-copier.com/webservice/v4/mapping/editMapping.php
You must specify a slave or group Id, but not both.
Response: JSON response description, with either how many mappings have been updated (0 or 1), or an error message
Fields noted with a * are optional
| Field Name | Field Type | Field Description |
|---|---|---|
| id_master | string | Unique identifier of the master account linked to the mapping |
| id_slave* | string | Unique identifier of the slave account linked to the mapping, or null if defining a template |
| id_group* | string | Unique identifier of the template linked to the mapping, or null if defining a slave |
| old_symbol | string | Old slave symbol of the mapping |
| old_symbol_master | string | Old master symbol of the mapping |
| symbol | string | New slave symbol you want to define it to |
| symbol_master | string | New master symbol you want to define it to |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/mapping/editMapping.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Bearer [[TOKEN]]',
);
// Open connection
$ch = curl_init();
// Setting the options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$args= ['id_slave' => "DEF", 'id_master' => "ABC", 'symbol' => 'NEW', 'symbol_master' => 'NEWMASTER', 'old_symbol' => 'APITEST', 'old_symbol_master' => 'TESTAPI'];
//$args= ['id_group' => "GHI", 'id_master' => "ABC", 'symbol' => 'NEW', 'symbol_master' => 'NEWMASTER', 'old_symbol' => 'APITEST', 'old_symbol_master' => 'TESTAPI'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($args));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Updated '.$json->updated_count.' mappings';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>