I am trying to add a note to a ticket with an attachment in Powershell but I always receive a 400 HTTP code (bad request)
I’ve already used a lot FreshService’s API and I always managed to make it work (adding note without attachment, creating service requests…).
But this time, attachments are really making me struggling a lot.
I’ve never send an attachment through an API (FreshService or something else) in any programming languages.
I’ve some problem understanding what should I send (type of object ?, path of the file ?, bytesof the files ?) in the body so FreshService’s API can recognize my file and I even tried to achieve that with other method (such as cURL) but I always failed.
If you have any tips or PowerShell code sample to help me, it would be very cool from you
Newbie to the whole Fresh universe, me & Google are pretty OK with Powershell.
What I’m attempting to do is, with PowerShell, using a Managed Identity on an Azure VM, mapped to an Az AD object, after having a ticket number in the mix from a support person, write a note to the Change, with the results of my validation script that runs against a newly created database in SQL Server.
Reading configuration out of an Azure SQL database, validating against SQL Server and writing to a PowerShell custom object.
1 piece left. The note on the change.
I would certainly appreciate anyone pointing me in a direction.
Firstly, welcome to the Freshworks community
Thank you for reaching out here.
I wasn’t very clear as to what you were trying to achieve, with Fresh *, but my best guess is that you were trying to add a note to an existing ticket on Freshdesk, for which you have a ticket number?
If that is indeed the case, have you checked out the Create Note API yet to see if that may help you?
A similar API is available for Freshservice in case I got the product line wrong from your question.
Do let us know if you are able to get this working. All the best!
Yes, yes, used that link to get where I am so far.
Unbelievable fast response too; I didn’t expect that.
Yes, yes, I am trying to post a note to an existing Change by change number, with Powershell.
I’ve made progress, meaning I got past credentialing with API-Key.
I’m using Invoke-RestMethod
Response I’m getting is:
StatusCode: 400
StatusDescription: Bad Request
I’m also using Powershell ConvertTo-Json.
I’m thinking that’s where the issue is.
I can hardly spell JSON, much less know what it is.