The following is how one can use REST to upload an attachment to SDM without associating to a given SDM ticket
Release 17.1 or higher
CA Service Desk Manager
This example shows how to use the HTTP client named Postman to upload text and image files to the CA Service Desk manager attachments repository.
The default attachment repository named "Service Desk" has a default repository id of 1002.
1. To attach a text file (named test.txt), use Postman and follow the format below.
POST: http://EXAMPLE-SDM-SERVER:8050/caisd-rest/attmnt?repositoryId=1002&serverName=EXAMPLE-SDM-SERVER&mimeType=Text&description=test.txt
Params:
Query Params:
KEY VALUE
repositoryId 1002
serverName EXAMPLE-SDM-SERVER
mimeType Text
description: test.txt
Headers:
KEY VALUE
X-AccessKey 237219108
Content-Type [{"key":"Content-Type","value":"multipart/form-data; BOUNDARY=*****MessageBoundary*****"
Pre-request Script
pm.environment.set("CR","\r");
Body > raw
--*****MessageBoundary*****{{CR}}
Content-Disposition: form-data; name="payload"
Content-Type: application/xml; CHARACTERSET=UTF-8
{{CR}}
<attmnt>
<repository id="1002"></repository>
<orig_file_name>test.txt</orig_file_name>
<attmnt_name>test.txt</attmnt_name>
<description>Upload using REST</description>
</attmnt>
{{CR}}
--*****MessageBoundary*****{{CR}}
Content-Disposition: form-data; name="test.txt"; filename="test.txt"
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
{{CR}}
testing testing
{{CR}}
--*****MessageBoundary*****--{{CR}}
2. To attach an image file (named test.gif), use Postman and follow the format below.
Note: The test.gif file must be already encoded in base64.
POST: http://EXAMPLE-SDM-SERVER:8050/caisd-rest/attmnt?repositoryId=1002&serverName=EXAMPLE-SDM-SERVER&mimeType=Text&description=test.gif
Params:
Query Params:
KEY VALUE
repositoryId 1002
serverName EXAMPLE-SDM-SERVER
mimeType Text
description test.gif
Headers:
KEY VALUE
X-AccessKey [integer value for access key for REST]
Content-Type multipart/form-data; BOUNDARY=*****MessageBoundary*****
Pre-request Script
pm.environment.set("CR","\r");
Body: > raw:
--*****MessageBoundary*****{{CR}}
Content-Disposition: form-data; name="payload"
Content-Type: application/xml; CHARACTERSET=UTF-8
{{CR}}
<attmnt>
<repository id="1002"></repository>
<orig_file_name>test.gif</orig_file_name>
<attmnt_name>test.gif</attmnt_name>
<description>Upload using REST</description>
</attmnt>
{{CR}}
--*****MessageBoundary*****{{CR}}
Content-Disposition: form-data; name="test.gif"; filename="test.gif"
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
{{CR}}
[INCLUDE BASE64 CONTENT HERE]
--*****MessageBoundary*****--{{CR}}