How To Upload and Download A File Using REST API
search cancel

How To Upload and Download A File Using REST API

book

Article ID: 432492

calendar_today

Updated On:

Products

Clarity PPM SaaS

Issue/Introduction

File attachments can uploaded to and downloaded from investments, using REST.

Resolution

A. Using Postman or similar application, upload a file using the POST request.

1. Use
Method POST
URL: http://<server>/ppm/rest/v1/virtual/attachments
Body Type: Multipart Form (Use Body > Keys)

Parameters:
resourceName: [e.g., custCustomInvTts]
resourceId: [e.g., 5354022]
resourceType: ODF
attributeName: [e.g., t_attachment]
File: [Select file from local directory]

2. Click Go/Run.

3. Review JSON response and look for the "attachments" array.

B. Using Postman or similar application, upload a file using the GET request.

1. Method GET
URL: http://<server>/ppm/rest/v1/custCustomInvTts/5354022

2. Click Go/Run.

3. Review JSON response and look for the "attachments" array.

http://<server>/ppm/rest/v1/virtual/attachments/eyJhdHRyaWJ1dGVDb2RlIjoiYXR0YWNobWVudHNfcXVpayIsInJlc291cmNlSWQiOjUyMjMwMDMsInZlcnNpb25JZCI6NTM2NDMxOSwicmVzb3VyY2VOYW1lIjoiYWFhYSIsImZpbGVJZCI6NTM2NDMxOH0

File is accessible via the generated url, e.g.

 "t_attachments_quik": {
    "attachments": [
      {
        "fileName": "text4_red.txt",
        "mimeType": "text/plain",
        "url": "http://<server>/ppm/rest/v1/virtual/attachments/eyJhdHRyaWJ1dGVDb2RlIjoiYXR0YWNobWVudHNfcXVpayIsInJlc291cmNlSWQiOjUyMjMwMDMsInZlcnNpb25JZCI6NTM2NDMxOSwicmVzb3VyY2VOYW1lIjoiYWFhYSIsImZpbGVJZCI6NTM2NDMxOH0"
      }

4. Enter the following in a browser to download the file:
http://<server>/ppm/rest/v1/virtual/attachments/eyJhdHRyaWJ1dGVDb2RlIjoiYXR0YWNobWVudHNfcXVpayIsInJlc291cmNlSWQiOjUyMjMwMDMsInZlcnNpb25JZCI6NTM2NDMxOSwicmVzb3VyY2VOYW1lIjoiYWFhYSIsImZpbGVJZCI6NTM2NDMxOH0