Hi Team,
I would like to attach document to the service request. Do we have any option to it through API’s?
@Freddy, Pls help us
Hi Team,
I would like to attach document to the service request. Do we have any option to it through API’s?
@Freddy, Pls help us
Hi Venkatgupta,
Yes, you can attach a document to the service request through API’s. To do this, you can use a POST request with multipart/form-data as content type. Here’s a sample request:
URL: https://your-organization.api.com/api/service-requests/{request_id}/attachments
Method: POST
Headers:
- Content-Type: multipart/form-data
- Authorization: Bearer {access_token}
Form data:
- file: (binary of your file)
- filename: (your desired filename)
Replace {request_id}
with the ID of the service request you want to attach the document to, and {access_token}
with your access token for authentication.
Please let me know if you need further assistance.
Apologies for any confusion, Venkatgupta. Yes, I can provide you with a solution for attaching a document to a service request specifically in Freshservice. To do this, you will use the Freshservice API. Here’s a sample request:
URL: https://your-domain.freshservice.com/api/v2/tickets/{ticket_id}/attachments
Method: POST
Headers:
- Content-Type: multipart/form-data
- Authorization: Basic {api_key}
Form data:
- attachment[]: (binary of your file)
Replace {ticket_id}
with the ID of the service request (also referred to as a ticket in Freshservice) you want to attach the document to, and {api_key}
with your base64 encoded API key for authentication (formatted as ‘api_key:X’). Please note that the ‘X’ is required in the base64 encoding.
Here is a Python example using the ‘requests’ library:
import requests
import base64
api_key = "your_api_key"
your_domain = "your_domain"
ticket_id = "your_ticket_id"
file_path = "your_file_path"
auth_header = "Basic " + base64.b64encode((api_key + ":X").encode("ascii")).decode("ascii")
headers = {
"Authorization": auth_header,
}
with open(file_path, "rb") as f:
files = {"attachment[]": (file_path, f)}
response