Hey everyone,
Can anyone tell me please how can I make a attachment request through REST API?
I am using the /sr/{id}/attachment url to add a new attachment to a service record.
Thanks in advance.
I have attached a screenshot of how I was able to do it using Postman.
Here are the highlights.
URL: /sr/{id}/attachment
Add a header:
Key: Content-Disposition
Value: multipart/form-data
The request body needs to be set to "form-data"
Add a file to the body using the below.
Key: file
Value: [attached the file here]
Content Type: The Content Type that matches your file.
Hope that helps!
JHamblen I have attached a screenshot of how I was able to do it using Postman.
Here are the highlights.
URL: /sr/{id}/attachment
Add a header:
Key: Content-Disposition
Value: multipart/form-data
The request body needs to be set to "form-data"
Add a file to the body using the below.
Key: file
Value: [attached the file here]
Content Type: The Content Type that matches your file.
Hope that helps!
Hi JHamblen!
You solved my problem! It worked!
Thank you, very very much!
I would like to ask how can I retrieve the attached file from Service Directory? I haven't found how I can use the REST API to retrieve the attachment file.
Hi JPires,
Hope you already figured it out but if not then here is a step by step guide:
Step 1 - Build URL
In order to add Attachments to a Service Record using RestAPI, you create need to use the POST method.
The URL in the API tool (e.g: Postman) should be for example:
https://accountID.sysaidit.com/api/v1/sr/123456/attachment
(replace the accountID and 123456 with the actual SR number)
Step 2 - populate on postman (or your chosen API builder)
In the "Body" select "form-data" radio button.
Under "KEY" you will have an option to select "FILE" and when you select that option, you will have in the "Type" column an option to select a file.
After the file (Attachment) is uploaded from the computer, then type file under KEY, and click Send button to use the POST method and successfully upload the attachment.
Step 3 - Validate input
You will see "200 OK" for confirmation.
Hope this helped let us know how it goes!
Cheers,
Maayan
JPires I would like to ask how can I retrieve the attached file from Service Directory? I haven't found how I can use the REST API to retrieve the attachment file.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.
Love what you're seeing?? Sign in to see exclusive content and contribute to the community!