Hi Community,
I'm new to SAS Viya and how it workds. I have a repository containing many SAS related files, jobs and reports. I want to create a python script to use SAS Viya APIs to load the files into SAS Viya. I looked into the documentation and I've found the /files/files endpoint to create a new resource file. I did a successful request by using this endpoint and I see a
I only used the /files/files endpoint createNewFile | SAS for Developers to create this file. Is this the right approach?
In general, what steps do I need to take to import a file to SAS Viya with API requests? Also, can someone tell me how I can distinguish different SAS scripts from each other (reports, jobs, scripts)?
Thanks,
Mehran
Publicly documented API's can be found here https://developer.sas.com/rest-apis
The /transfer API as seen in Moving SAS® Viya® Contents: A RESTful Way - SAS Support Communities is not publicly available. So the documented way of doing an import, is to use the sas-viya transfer plugin.
Some questions:
When adding plain text files did you specify the parentFolderUri query parameter?
So, the files I want to import are not plain txt files and they have json format. I assume that they are exported by SAS content folders. I see different type tags in the json file such as "application/vnd.sas.transfer.object", "application/vnd.sas.file", and many more. I did not provide the parentFolderUri in the header part of my request. I did not see this requirement in the documentation. Is it necessary to provide this?
So they seem to be SAS packages. These files can be imported using the sas-viya CLI using the transfer plugin.
To make things easier check this https://github.com/sassoftware/pyviyatools/blob/master/importpackages.py it does the thing you are looking for. It uses the sas-viya CLI in the background to the work.
Thanks. Does it mean that I cannot import SAS packages with Rest APIs?
I've seen this approach before and I thought an endpoint is available to transfer these files. I found this link from the community.
Moving SAS® Viya® Contents: A RESTful Way - SAS Support Communities
Are SAS packages a special type of file in SAS which can only be imported with CLIs?
Publicly documented API's can be found here https://developer.sas.com/rest-apis
The /transfer API as seen in Moving SAS® Viya® Contents: A RESTful Way - SAS Support Communities is not publicly available. So the documented way of doing an import, is to use the sas-viya transfer plugin.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!