and more in a single search tool across platforms. Read the announcement here. |
04/25/2023 04:38 AM
Hi,
We would like to periodically upload a data file via Saviynt's REST interface so that a schema job can then perform the import of the data.
We followed the documentation in Postman:
Saviynt Enterprise Identity Cloud API Reference v23.4 (getpostman.com)
Unfortunately, the response we get is: {"msg": "file not found", "errorCode": "1"}
The documentation refers to a file InternalConfig.groovy that does not exist in our system.
We were able to find the parameter job.ecm.imp.file.path in in externalConfig.properties, where it is set to the file extension that we want to use for the upload.
So the questions are:
Thanks for any help.
Kind regards,
Petra Bremer
Solved! Go to Solution.
05/02/2023 08:25 AM
Hello,
is there anyone who has already successfully imported a data file into the Saviynt folder /saviynt_shared/Import/Datafiles/ via the REST interface with uploadSchemaFile?
Did any special settings have to be made for this?
05/02/2023 09:08 AM
yes
07/27/2023 11:04 AM
Hi @petra_bremer ,
Saviynt rest api to upload file expect file present in the body rather than file path.
In postman we can directly attached file in the body that’s why it will work in postman.
05/02/2023 09:16 AM
I tried it with a Powershell script and followed the documentation stored in Postman:
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer "+$token)
$headers.Add("Content-Type", "application/json")
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
$multipartFile = "./TTA_Partner2022/data/orgDataUpload.xlsx"
$FileStream = [System.IO.FileStream]::new($multipartFile, [System.IO.FileMode]::Open)
$fileHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$fileHeader.Name = "file"
$fileHeader.FileName = "orgDataUpload.xlsx"
$fileContent = [System.Net.Http.StreamContent]::new($FileStream)
$fileContent.Headers.ContentDisposition = $fileHeader
$multipartContent.Add($fileContent)
$stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$stringHeader.Name = "pathLocation"
$stringContent = [System.Net.Http.StringContent]::new("Datafiles")
# /saviynt_shared/Import/Datafiles/
$stringContent.Headers.ContentDisposition = $stringHeader
$multipartContent.Add($stringContent)
$body = $multipartContent
$url = $parameterJSON.url
$urlPost=$url+"/ECM/api/v5/uploadSchemaFile"
$response = Invoke-RestMethod -Uri $urlPost -Method 'POST' -Headers $headers -Body $body
$uploadJSON = $response | ConvertTo-Json
Write-Host $uploadJSON
05/05/2023 05:26 AM
Hi Peter,
Are you able to solve this error ? {
"msg": "file not found",
"errorCode": "1"
}
We are also writting powershell script. Its giving same error.
Could you please guide if you able to solve this ?
05/05/2023 09:36 AM
we are still working on this. We hope for further support from Saviynt support or Saviynt users in the forum. We will share the solution with the forum as soon as there is anyone.
05/03/2023 03:08 AM
I have recreated the situation in Postman - again without result, but with a different error message:
05/03/2023 04:32 AM
Please check shared directory path in externalconfig
05/03/2023 05:58 AM
That was precisely the aim of my initial question.
The Postman documentation talks about
property job.ecm.imp.file.path in InternalConfig.groovy.
We only found this property in externalConfig.properties (what is InternalConfig.groovy??).
in the externalConfig.properties our setting looks like this:
#job.ecm.savfile.path=/saviynt_shared/Import/SAV/
job.ecm.imp.file.path=/saviynt_shared/Import/Datafiles/
#job.ecm.imp.file.importprocess.path=/saviynt_shared/Import/Process/
We have already tested the upload with an without activated path parameter - both without success.
The only consequence of the activated entry was that the menu item Datafiles under Settings=> File Directory is now missing.
05/03/2023 04:29 AM
In Log, we find following message:
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"2023-05-03 11:24:10,337 [http-nio-8080-exec-7] DEBUG ws.Restfulv5Controller - Exception occurred while uploading the file : \n","stream":"stdout","time":"2023-05-03T11:24:10.337703356Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"java.io.FileNotFoundException: /saviynt_shared/Import/Datafiles/orgDataUpload.xlsx (No such file or directory)\n","stream":"stdout","time":"2023-05-03T11:24:10.337722526Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at java.io.FileOutputStream.open(FileOutputStream.java:270)\n","stream":"stdout","time":"2023-05-03T11:24:10.337738074Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at java.io.FileOutputStream.\u003cinit\u003e(FileOutputStream.java:213)\n","stream":"stdout","time":"2023-05-03T11:24:10.337740856Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at java.io.FileOutputStream.\u003cinit\u003e(FileOutputStream.java:162)\n","stream":"stdout","time":"2023-05-03T11:24:10.337747072Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:417)\n","stream":"stdout","time":"2023-05-03T11:24:10.337752944Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at com.saviynt.ws.Restfulv5Service.saveFileSuccessInEcm(Restfulv5Service.groovy:302)\n","stream":"stdout","time":"2023-05-03T11:24:10.337785517Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at com.saviynt.ecm.ws.Restfulv5Controller$_closure210.doCall(Restfulv5Controller.groovy:18774)\n","stream":"stdout","time":"2023-05-03T11:24:10.33779166Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at grails.plugin.springsecurity.rest.RestTokenValidationFilter.processFilterChain(RestTokenValidationFilter.groovy:118)\n","stream":"stdout","time":"2023-05-03T11:24:10.337798076Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at grails.plugin.springsecurity.rest.RestTokenValidationFilter.doFilter(RestTokenValidationFilter.groovy:84)\n","stream":"stdout","time":"2023-05-03T11:24:10.33780434Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)\n","stream":"stdout","time":"2023-05-03T11:24:10.337810145Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at com.saviynt.webservice.SaviyntRestAuthenticationFilter.doFilter(SaviyntRestAuthenticationFilter.groovy:144)\n","stream":"stdout","time":"2023-05-03T11:24:10.337815012Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:62)\n","stream":"stdout","time":"2023-05-03T11:24:10.33781912Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.java:59)\n","stream":"stdout","time":"2023-05-03T11:24:10.337823066Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at com.mrhaki.grails.plugin.xframeoptions.web.XFrameOptionsFilter.doFilterInternal(XFrameOptionsFilter.java:69)\n","stream":"stdout","time":"2023-05-03T11:24:10.337837536Z"}"
"ecm","2023-05-03T11:24:10.570+00:00","{"log":"\u0009at com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:82)\n","stream":"stdout","time":"2023-05-03T11:24:10.337841682Z"}"
05/09/2023 01:54 AM
Please try following path : /saviynt_shared/saviynt/Import/Datafiles
05/09/2023 06:07 AM
Hello Rakesh,
thank you for this tip. It really helped!!!
We have set the parameters in the externalConfig.properties as follows:
job.ecm.imp.file.path=/saviynt_shared/saviynt/Import/Datafiles/
In the TTA partner environment as well as at the customer environment, we were able to upload a data fiel via Postman.
So far we had always taken the file path that was commented out in the externalConfig: /saviynt_shared/Import/Datafiles/ and have nowhere found a hint in the documentation that the path must be different.
So again, many thanks for this very useful tip.
07/27/2023 08:44 AM - edited 07/27/2023 08:44 AM
@RakeshMG and @rushikeshvartak
Can we upload the files in bulk instead of single file upload.
07/27/2023 08:48 AM
Single file
05/09/2023 06:28 AM
It now works via Postman.
But the CURL call from the documentation
still gives the error:
{ "msg": "file not found", "errorCode": "1" }
What's wrong with the CURL call?
07/27/2023 01:40 PM
07/31/2023 09:06 AM
It doesn't work