Hi. I want to import some tickets along with attachments from another freshservice tenant.
I have an export of the attachments containing the following info:
ticket_id 54
id 21000006173
created_at 2022-06-21T09:14:03Z
updated_at 2022-06-21T09:14:07Z
name UOS_CHN-68.pdf
attachment_url https://devtesting2.attachments.freshservice.com/data/helpdesk/attachments/production/21000006173/original/UOS_CHN-68.pdf?response-content-type=application/pdf&Expires=1655890141&Signature=hbssI1usxE5P6-fymYXvSLrU6VAtMKMhnBiVFuroxzqarslf-bwEwgiUf8schFBpt~y-0Dj-ofeVjf3KX9XsWQ1xqjCu1KAjnpggnQx396a1ZnJp2yLLnOn5OKt3Kwo3-CHl-2Zruav0lvSW1T7bi8vxo8O1k0FdudbfAc~CtqoiWmYcdu~1C~rsN0BP5ltpLSROdcWv8w7bmOXkoySuszbRvhqde-LppOWTPUDePHRPamRk5US9AbEWYDG28rINi23QrqWMKsCUL0NwjeP6kylG35Gse4-HIT-qwYIPQmm~X6k7DbmftuE8oKDf2mOzRXGZSlWeifHJ4Qq6yl4B4w__&Key-Pair-Id=APKAIPHBXWY2KT5RCMPQ
content_type application/pdf
size 178568
canonical_url https://devtesting2.freshservice.com/helpdesk/attachments/21000006173
The create ticket documentation (Service Desk API for Developers | Freshservice) just says “array of attachments” as the attachment input. Can you clarify how I could import the above example alongside the ticket? (a curl example would be amazing)
curl -v -u user@yourcompany.com:test -F 'attachments[]=@/Users/user/Desktop/api_attach.png' -F 'subject=Support Needed...' -F 'description=Details about the issue...' -F 'email=tom@outerspace.com' -F 'priority=1' -F 'status=2' -X POST 'https://domain.freshservice.com/api/v2/tickets'
In order to create ticket with attachment using the API, you need to download the attachments locally and then use the create ticket API as shown in example.
I am not so familiar with PowerShell however to create a ticket with attachment we need to set the header “content-type” as “multipart/form-data”.
I looked on internet and looks like PowerShell does not have the ability to do so.
Found one topic in stackoverflow on sending files using PowerShell and REST API.