Question

Transferring attachments from the API

  • 18 January 2024
  • 2 replies
  • 88 views

Badge +1

We’re trying to create sub-tickets (*not actual “Child Tickets*) via an API call, but we need to be able to transfer attachments from the main ticket to them (they generally only have one attachment).

When I attempt to put the attachment section from the JSON of the parent ticket into the creation payload, I get a Validation Failed on attachments field of datatype_mismatch with message “It should be of type valid file format”.

Here’s the payload I’m putting into my POST to /api/v2/tickets

{
"email": "REDACTED@redacted.org",
"status": 2,
"priority": 1,
"source": 1,
"subject": "Child Vaya Onboarding Test",
"description": "This is a test to Business Apps. Please refer to the parent ticket for attachments.",
"workspace_id": 2,
"group_id": 23000165356,
"attachments": [
{
"id": 23005786611,
"content_type": "application/octet-stream",
"size": 1306,
"name": "EMP--2024_01_18.csv",
"attachment_url": "https://REDACTED.attachments.freshservice.com/data/helpdesk/attachments/production/23005786611/original/EMP--2024_01_18.csv?response-content-type=application/octet-stream&Expires=1705702403&Signature=hHUklMRKDi9U4P0RWzp9Zq3fbGzG2w~5J7ERH3RFnqq90cLrS3K~0T7gCcsjQrbkbgJ4DQtf895nW1IzP2tgbKO0hEJDjEkd6iyGSafn~ZR2uosn-CEOwjDpMaTRYwtvxWOn1NzfVFiELLXOsYM0P5Ac4teQpJimzmDfXbNzysU1m7g5RT-pyvJnexMsenaWvobmnlucb-1Nr9GyKnVC70kqTnFUJfyHoWrNs40hRpNu~rOAiJsh4OAaKwxDpegLwGL3DFDfuMz9P6QwuKDakwelUjgYbR3T6odCXOaloOkkjAj-cqbgu4P0Z6XtqGnSGxvpsxompVjmSsMPT7FQbQ__&Key-Pair-Id=APKAIPHBXWY2KT5RCMPQ",
"created_at": "2024-01-18T13:45:12Z",
"updated_at": "2024-01-18T13:45:12Z"
}
]
}

Any help would be greatly appreciated.


2 replies

Userlevel 7
Badge +13

Freshdesk webhook do not allow to change the data type. So it can’t be done. 

Userlevel 7
Badge +13

You may need to look at a app for this. 

Reply