To upload files, you must specify Multipart/form-data as the content type in the web request. This content type allows you to send files or large amounts of data in a post in combination with other data. The Multipart/form-data content type tells the HTTP request that the posted data must be broken into parts.
This multi-part upload operation initiates a multipart upload, which returns an UploadID used to associate all of the parts in the specific multipart upload. You specify the UploadID in each of your subsequent upload part requests and can include it in the final request to either complete or abort the multipart upload request.
There are four steps used to upload a file to a document:
You cannot upload certain file formats or file name extensions. For more information,
see Site Settings node properties.
Upload a file
You can upload a file in one operation using the following POST
<ACCESS_URL>/api/v2/FileMgmt/UploadFile
The following parameters can be used in the request body specifically to upload a file:
type: resume
part: 1
The following headers can be used specifically to upload a file:
Accept: */*
Content-Type: multipart/form-data;
The following settings can be used in PostmanĀ® to setup a file path in the body of the POST:
-
Add the key name as File.
-
Select File instead of Text to set the value of the uploaded file to the File key.
The following is an example of the response:
{
"Status": "OK",
"UploadId": "694d169e-1597-405b-b159-09697f946ebc",
"Expires": "2020-06-11T10:16:28.411Z"
}
Commit the file using the UploadID
You can commit a file using the UploadID in the following POST:
<ACCESS_URL>/api/v2/FileMgmt/UploadFile
The following parameters can be used in the request body specifically to commit the file using UploadID:
type: commit
UploadId: UploadID_Value
For example,
type: commit
UploadId: 694d169e-1597-405b-b159-09697f946ebc
The following headers can be used specifically to commit the file using UploadID:
Accept: application/json, text/plain, */*
Content-Type: application/json
The following is an example of the response:
{
"Status": "OK",
"UploadId": "694d169e-1597-405b-b159-09697f946ebc"
}
Make the upload file available
You can make the upload file available using the following POST:
<ACCESS_URL>/api/v2/FileMgmt/MakeUploadAvailable
The following headers can be used specifically to make the upload file available:
Accept: application/json, text/plain, */*
Content-Type: application/json
The following content can be used in the request body specifically to make the upload available in the body of the POST:
{"Filename": "UploadID_Value"}
For example,
{"Filename": "694d169e-1597-405b-b159-09697f946ebc"}
The following is an example of the response:
{
"@odata.context": "<ACCESS_URL>/api/v2/FileMgmt/$metadata#Edm.Boolean",
"value": true
}
Attach a file to the document
You can attach the file to a document using the following POST:
<ACCESS_URL>/api/v2/FileMgmt/Upload('UploadId_Value')/
Intergraph.SDX.Server.API.Model.Attach
The following headers can be used specifically to attach a file to a document:
Accept: application/json, text/plain, */*
Content-Type: application/json
The following content can be used specifically in the body of the POST:
{"ClientFilePath": "FILE_NAME",
"FileClass": "SDXDesignFile",
"TargetObjectOBID": "DOCUMENT_OBJECT_ID"}
For example,
{"ClientFilePath": "SampleTestDocument.txt",
"FileClass": "SDXDesignFile",
"TargetObjectOBID": "6FL1000A"}
The following is an example of a request URL:
<ACCESS_URL>/api/v2/FileMgmt/Upload('694d169e-1597-405b-b159-09697f946ebc')/Intergraph.SDX.Server.API.Model.Attach