2
從Asana獲取數據似乎工作正常,當我通過Invoke-RestMethod
添加數據時,它允許我創建任務,但名稱,備註字段和受理人未被填充。有任何想法嗎?通過powershell將數據添加到asana
例如:
function Add-asanaTask {
param([string]$apikey, [string]$taskName, [string]$notes, [string]$assignee, [string]$workspaceid,[string]$projectid, $url = 'https://app.asana.com/api/1.0/workspaces/{0}/tasks')
$apikey = "{0}:" -f $apikey
$url = $url -f $workspaceID
$url
$Mykey = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($apikey))
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization","Basic $Mykey")
$task [email protected]{
[email protected]{
assignee= @{"id"=$assignee};
name=$taskname;
notes=$notes;
[email protected]{"id"=$projectid}
}
}#end task object
$json = $task | ConvertTo-Json
$response = Invoke-RestMethod $url -Method Post -Body $json -Headers $headers
return $Response.data
}
add-asanatask -apikey "apikey" -taskName "test task" -notes "hello world" -assignee "assignee ID" -workspaceid "workspace ID" -projectid "project ID"