BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
EyalGonen
Lapis Lazuli | Level 10

I need to upload a file from my local disk to a SAS Content folder. I am using the SAS REST APIs for this.

 

I am a bit confused reading the API doc on https://developers.sas.com. On the one hand in the "folders" API there is an option to add a "member" to an existing folder. On the other hand, on the "files" API there is an option to create a new file. Not sure what to use and what is the relationship between the two.. Any advice?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ
The files service has an optional parentFolderUri query parameter you can use to specify the folder the file should be added to (/folders/folders/folder_id), but uploading a file does not require it be referenced by SAS Content (folders service). When you specify parentFolderUri, the files service will call the folders service to confirm there is not already a file with that name in the folder, and add the file as a member for you if it is not already a member of that folder.
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

4 REPLIES 4
gwootton
SAS Super FREQ
The files service has an optional parentFolderUri query parameter you can use to specify the folder the file should be added to (/folders/folders/folder_id), but uploading a file does not require it be referenced by SAS Content (folders service). When you specify parentFolderUri, the files service will call the folders service to confirm there is not already a file with that name in the folder, and add the file as a member for you if it is not already a member of that folder.
--
Greg Wootton | Principal Systems Technical Support Engineer
joeFurbee
Community Manager

Hi @EyalGonen,

You can use the Upload a file end point under the dataTables API. I'm attaching a Postman collection with example usage. Look in step 2. upload data for an example.


Join us for SAS Community Trivia
SAS Bowl XL, SAS Innovate 2024 Recap
Wednesday, May 15, 2024, at 10 a.m. ET | #SASBowl

EyalGonen
Lapis Lazuli | Level 10

Hi @joeFurbee 

 

I need to upload text files such SAS programs or binary files like JPG files. Is your solution appropriate for these use cases?

joeFurbee
Community Manager

Hi @EyalGonen,

Yes, a text file should be fine. In my example (see below) I use a csv file. In order to provide the file path, I went to the Body section, created a new file Key and provided the path from my client as the Value.

joeFurbee_1-1720708193890.png

 

I've not tried with .jpg. Would be interested if that works or not.

 


Join us for SAS Community Trivia
SAS Bowl XL, SAS Innovate 2024 Recap
Wednesday, May 15, 2024, at 10 a.m. ET | #SASBowl