By analyzing the requests in Chromium developer, I found the structure of request.A secondary tag can be created by following code.It seems to be difficult to reorder tags using the api since we have to reorder entire tags.
public function createTag($tagname,$slug,$description)
{
$data= [
"data" => [
"type" => "tags",
"attributes" => [
"name" =>$tagname,
"slug" => $slug,
"description" => $description,
"color" => "",
"ishidden"=>false]
]
];
$response = $this->sendPostRequest('/api/tags', $data);
var_export($response);
}