最近搜索
没有最近搜索

Robert Pearman
已加入2021年5月28日
·
最后活动2021年10月16日
关注
0
关注者
0
活动总数
4
投票
0
订阅
1
活动概览
标记
文章
帖子
社区评论
文章评论
活动概览
的最新活动 Robert Pearman
Robert Pearman 创建了一个帖子,
帖子 Developer - Zendesk APIs
I have read a lot of the posts about this subject but not quite gotten the answer i need.
I am using PowerShell to upload files to ZenDesk, i have it working for the most part. The file is uploaded and i can link it to a ticket.
The problem i have is the content of the file remains as the base64 string, i guess i have something wrong somewhere?
$uploadURL = "https://mysystem.zendesk.com/api/v2/uploads.json"
$fileName = "C:\myfolder\outputlog.log"
$shortFileName = "outputlog.log"
$fileUploadURL = ($uploadURL, "filename=$shortFileName" -join "?")
$fileContent = Get-Content $filename
$fileContentBytes = [System.Text.Encoding]::Unicode.GetBytes($fileContent)
$fileBinary = [System.Convert]::ToBase64String($fileContentBytes)
Invoke-WebRequest -Uri $fileUploadURL -Headers $headers -Method post -ContentType "application/binary" -Body $fileBinary
StatusCode : 201
StatusDescription : Created
Also tried this, $fileBinary = [Convert]::ToBase64String((Get-Content -Path $fileName -Encoding Byte)) with the same result.
已于 2021年1月14日 发布 · Robert Pearman
0
关注者
1
投票
2
评论