Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Can we access Data Files using Saviynt API or Java File API

rashmirudrappa
New Contributor III
New Contributor III

Hi Team,

How can we access Data Files using Saviynt API ? 

OR

How can we access Data Files using Java?

 

Thank you

Rashmi

12 REPLIES 12

rushikeshvartak
All-Star
All-Star

Yes you can access saviynt data files using code

/saviynt_shared/saviynt/Import/Datafiles/ is path

https://www.tutorialspoint.com/how-to-read-data-from-all-files-in-a-directory-using-java


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

rahul_p
Regular Contributor II
Regular Contributor II

Hi @rushikeshvartak ,

The above mentioned path will be :

https://<URL>/api/<path>/saviynt_shared/saviynt/Import/Datafiles/<fileName>

On the API document its only mentioned to create the data file but how to access it is not mentioned.

Regards,

Rahul

We are accessing files from data files in custom jar. We have placed properties file in data files 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

rahul_p
Regular Contributor II
Regular Contributor II

Hi @rushikeshvartak ,

Basically I need to add new entries into dataset, which is not supported directly using any API.

The statement which you mentioned is not fully clear.

We are accessing files from data files in custom jar. We have placed properties file in data files.

My requirement is on high level is:

I need to create CSV file with some data which I will fetch from third party application in java code and same I can use to import in dataset.

So solution I thought is : I will create a CSV file in file directory . Then will add/update the entries in CSV with the data which java code is fetching from third party application. Same CSV will import into Dataset

Is this possible?

If yes, then can you please share how to access and update data file from JAVA code?

Regards,

Rahul

You can use {{url}}/ECM/{{path}}/uploadSchemaFile and update same file by reading existing file and append existing csv

 

https://documenter.getpostman.com/view/23973797/2s9Ykhh4VH#d192104b-2fe3-4bc7-9b3a-e391cb9da057


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

rahul_p
Regular Contributor II
Regular Contributor II

Hi @rushikeshvartak ,

How to access the data file in code? 

Is it like below:

https://<URL>/api/<path>/saviynt_shared/saviynt/Import/Datafiles/<fileName>

Also, How to update the data file in code? means as its an cloud solution, we can not have any on premise file stored which can be used to upload to Saviynt.

So is there any option to update existing data file?

Or to access &/or update data file in JAVA code is not possible?

Please comment.

Regards,

Rahul

 

Reading files from data files

private static final String PROPERTIES_FILE =
"/saviynt_shared/saviynt/Import/Datafiles/credentials.csv";
static {
 
//
FileReader reader = null;
props = new Properties();
 
try {
 
 
reader = new FileReader(PROPERTIES_FILE);
props.load(reader);
MAXRETRYCOUNT=props.getProperty("MAXRETRYCOUNT");
}

 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

rahul_p
Regular Contributor II
Regular Contributor II

Hi @rushikeshvartak ,

Is there any way using which we can update data file using API?

If yes, then can you please provide details like API and how we can refer the data file in the code.

Regards,

Rahul

As mentioned previously read existing file and append data again


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

rahul_p
Regular Contributor II
Regular Contributor II

Hello @rushikeshvartak ,

There NO API shown in API document to read and append the data to data file.

Only API available is Upload New File:

rahul_p_0-1703749007734.png

Regards,

Rahul

 

First read file i have shared sample snippet then again create new file with same file so it will replace existing file.


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

rahul_p
Regular Contributor II
Regular Contributor II

Hi @rushikeshvartak ,

Thank you for snippet, facing below issue with it:

Exception occurred java.io.FileNotFoundException: \saviynt_shared\saviynt\Import\Datafiles\<fileName>.csv (The system cannot find the path specified)

 

Also, if we read the file as well, during write operation we will need to specify filename there as well, as its SAAS solution, how can we refer file which is uploaded on the server directly in the code?

In addition, upload file API requires actual file it self, so whether this will work with file path? that's also is an question.

Thanks,

Rahul