Skip to main content

I am trying to use PowerShell to add a private note to a ticket, I don't want it to be a plublic note as it might confuse the users. Any ideas?

Did you set the below:

"private":true

https://api.freshservice.com/#create_a_note


How would I do that in PowerShell as I am pretty new to this.


This command is not working after filling in the details with the user email or API key. I have also confirmed the URL is correct.

curl -v -u user@yourcompany.com:test -H "Content-Type: application/json" -X POST -d '{ "body":"Hi tom, Still Angry", "private":false }' 'https://domain.freshservice.com/api/v2/tickets/265/notes'


Note: Unnecessary use of -X or --request, POST is already inferred.
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
Note: Unnecessary use of -X or --request, POST is already inferred.
* Could not resolve host: Still
* Closing connection 0
curl: (6) Could not resolve host: Still
curl: (3) unmatched close brace/bracket in URL position 22:
Angry, private:false }


Figured it out

curl.exe -v -u "%API KEY%:." -F 'body=Details about the issue...' -X POST 'https://domainname.come/api/v2/tickets/ticketnumber/notes'
 


$Body = @{body = "test"}

$credPair = "%APIKEY%:."
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credPair))
$headers = @{ Authorization = "Basic $encodedCredentials" }
Invoke-WebRequest "https://%Domain-name.com%/api/v2/tickets/%TICKET-NO%/notes" -Headers $headers  -ContentType "application/json" -Method Post -Body ($Body | ConvertTo-JSON) -UseBasicParsing


Hi @ColePatterson20 good work getting this work correctly. Can be tricky when first starting out.


Reply