Upload file-format with PowerShell

  • 0
  • 1
  • Question
  • Updated 4 weeks ago
  • Answered
Anyone having any idea, on how to use powershell to upload a format-file to delphix masking?
Photo of Torben Hansen

Torben Hansen

  • 250 Points 250 badge 2x thumb

Posted 1 month ago

  • 0
  • 1
Photo of Hims

Hims, Employee

  • 2,306 Points 2k badge 2x thumb
Official Response
Hi Torben,
Thanks for reaching out.

The PowerShell function Invoke-RestMethod (details here) will be used to call the endpoint as below
curl -X POST --header 'Content-Type: multipart/form-data' --header
'Accept: application/json' --header 'Authorization:
d1313dd8-2ed9-4699-8e88-2b6a089ae2a6' -F
fileFormat=@/path/to/file_format/delimited_format.txt -F
fileFormatType=DELIMITED 'http://<myMaskingEngine>:8282/masking/api/file-formats'
This endpoint is available from Delphix 5.3 onwards, detailed documentation is here

Thanks
Hims
Photo of Torben Hansen

Torben Hansen

  • 250 Points 250 badge 2x thumb
Thanks for you reply.

In the documentation for version 5.26 you can find the same endpoint doc, are you telling me, despite this doc, the endpoint is first active in release 5.3? :-)

https://docs.delphix.com/docs526/delphix-masking/masking-api-cookbook/api-calls-involving-file-uploa...

Im now home, at my test environment (running 5.3), and here it works, will test it in production (5.2) tomorrow


Photo of Torben Hansen

Torben Hansen

  • 250 Points 250 badge 2x thumb
Done testing, it works in 5.2.5.0
Would have preferred to use API, but for now, thats okay.
Thanks

Photo of Torben Hansen

Torben Hansen

  • 250 Points 250 badge 2x thumb
You where so kind to help me with the file-format, file-metadata is also a problem
This Curl command :

C:\delphix\curl.exe -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: 9c615d69-6f3a-4f58-8bb9-0b216ffa007f' -d '{ \ "fileName": "C:/Delphix/BS.REC00002.CSV",\ "rulesetId": 52,\ "fileFormatId": 112,\ "delimiter": ";",\ "endOfRecord": "\n" \ }' 'http://pfanpdpxma01.prod.pfaintern.dk:8282/masking/api/file-metadata'

gives the following output
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: 9c615d69-6f3a-4f58-8bb9-0b216ffa007f'
curl: (6) Could not resolve host: \
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: 52,\
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: 112,\
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: ;,\
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: \n
curl: (6) Could not resolve host: \
curl: (3) unmatched close brace/bracket in URL position 1:
}'
 ^
curl: (3) URL using bad/illegal format or missing URL

Photo of Torben Hansen

Torben Hansen

  • 250 Points 250 badge 2x thumb
Syntax error.
C:/Delphix/BS.REC00002.CSV
is
BS.REC00002.CSV
but same error