Sage CRM 2022 R2: RESTful API Expansion: File Upload enhancement

1 minute read time.

In Sage CRM 2022 R2 we have extended the REST API to allow a developer to specify a target folder for the uploaded files. The ability to upload files had been added to the REST API in Sage CRM 2021 but the file would only be uploaded into a temporary folder.

We have now added a hiddenUserFolder parameter to the Upload a file to a folder endpoint.

You can use this optional parameter to specify the name of a subfolder in <Sage CRM installation folder>\Library\ to upload the specified file to. If the subfolder does not exist, the endpoint creates it.

The upload method is shown being used in Postman below.

The file to be uploaded is attached using the POST section 'hiddenFileUpload' field and the target folder is 'hiddenUserFolder'

If the upload is successful then a status of 'Success' will be returned.

See also: Sage CRM 2021 R1: RESTful API Expansion - Managing documents https://www.sagecity.com/sage-global-solutions/sage-crm/b/sage-crm-hints-tips-and-tricks/posts/sage-crm-2021-r1-restful-api-expansion---managing-documents

Note: If you omit the hiddenUserFolder parameter, the file is uploaded to <Sage CRM installation folder>\Library\TEMP\<SID>, where <SID> is the session ID you use to authenticate your call.

By default, Sage CRM is installed to %ProgramFiles(x86)%\Sage\CRM\CRM.

To try out the hiddenUserFolder parameter, use a Postman collection provided for Sage CRM 2022 R2:

  1. Import the .json files from the Postman collection into Postman.
  2. Configure Postman as described in the Sage CRM 2022 R2 REST API reference.
  3. In the imported collection, expand the RESTful API endpoints (formerly SData) folder.
  4. Run the first request to obtain a session ID.
  5. Run the Upload a file to a folder request.
Anonymous