Upload a document to a workspace

Using the Platform API Client SDK - JavaScript ( i.e., purecloud-platform-client-v2 ), I would like to know how to upload a simple text file to a workspace. I see the Example Usage in both the API Explorer, as well as under the Content Management APIs for "postContentmanagementDocuments" on:

For example:
...
let apiInstance = new platformClient.ContentManagementApi();

let body = {}; // Object | Document
...
etc...

However, I haven't come across an actual 'working' example. Moreover, the 'Upload Documents' section on:

states that "Document uploading is a two part process:

1.) Create a document. Make a request to upload a document to a specific workspace.
2.) Upload the document file. A URI is returned in the previous step to upload the contents of the document's file.

I'm assuming these two statements are the underlying requirements when making actual REST API requests.

Can anyone tell me if this two-part document upload process can be accomplished via the SDK (e.g., postContentmanagementDocuments) alone, or with postContentmanagementDocumentContent, or does it require a non-SDK step, like me having to make my own REST API call (via Axios/Fetch) to perform the actual file upload?

I'm just confused if and how the SDK handles the described two-step process without seeing a full example.

Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.