REST API Attachment

 
Author
Message
SysAider
11
 
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.
SysAider
1
 
Same here please.
SysAider
1
 
Has there been any update on this? I'm having the same problem.
SysAider
5
 
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!
SysAider
11
 
JHamblen wrote: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!
SysAider
3
 
Is there a way to instead Get attachments via the API that is retrieve attachments related to an SR Record?
I can't find that anywhere.
SysAider
3
 
I would like to ask if you have already been able to retrieve the attachment file from the Service Desk directory using RESP API?
SysAider
3
 
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.
SysAid Product Manager Community Manager
122
 
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 wrote: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.