Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue with file upload to the DM cloud using PowerShell and REST

M_SladicJan 18 2019

I am now trying to replicate in PowerShell, an excellent blog from John G. on reloading rejected records from the initial FDMEE (DM) load into the EPBCS. Things worked well until I got to the part of uploading to the cloud (to DM) previously created rejected records' file (e.g., "rejects.txt"). I tried following his blog, but the code kept failing. Here is the information using REST metod from the blog. This is description of the REST method attampt.

Please note that before this part of the code, I am successfully logging in, executing data load in DM, downloading the load log, etc. All variables below,if not specifically noted, are good, as they are used elsewhere with success). Also, the "Invoke-RestMethod-pxy" is a proxy function I created based on previous help from John G., and it works too):

Code in PowerShell:

     ...

  # delete previously uploaded Product reject file (most likely won't be there, but just in case)

    $uri = $fileUrl+[System.Net.WebUtility]::UrlEncode($uploaddir + $dimProductFile)

    $restResponse = Invoke-RestMethod-pxy -Uri $uri -Method Delete -Headers $headers ******** <----- this line works, tested it with a dummy file *******

    # upload the reject file - REST;

    $uri = $fileUrl + $dimProductFile + "/contents?q={""islast"":true,""extDirpath"":""" + $uploaddir.replace("\","/") + """,""chunkSize"":52428800,""isFirst"":true}"

    $restresponse = Invoke-RestMethod-pxy -Uri $uri -Method POST -Headers $headers -InFile($dimProductFileFull) -ContentType "application/octet-stream"

    if($restresponse.status -ne 0) {

        LogWrite "The upload of the $dimProductFileFull to the Cloud has failed."

        exit $LastExitCode

    }

Variables:

$uri = https://planning-test-efyk.pbcs.us6.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/1602_rejProduct.txt/contents?q={"islast":true,"extDirpath":"inbox/CANRptg_ACT/","chunkSize":52428800,"isFirst":true}

$dimProductFileFull = "E:\App\Oracle\EPM Automate\bin\rejects.txt"

This is followed by REST call:

     $restresponse = Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -InFile($dimProductFileFull) -ContentType "application/octet-stream"

Result:

Invoke-RestMethod : Unplanned Outagehtml, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike,

strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, embed, figure, figcaption, footer, header,

hgroup, menu, nav, output, ruby, section, summary,time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline;}em { font-style: italic;}/* HTML5 display-role reset

for older browsers */article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block;}body { line-height: 1;}ol, ul { list-style: none;}blockquote, q { quotes:

none;}blockquote:before, blockquote:after,q:before, q:after { content: ''; content: none;}table { border-collapse: collapse; border-spacing: 0;}body {   background-image:

url(https://servicestatus.cloud.oracle.com/outage/img/bg-tile-diag.png);    font-weight: normal;   font-family: Arial,sans-serif;   font-size: 9pt;   color:#4F4F4F;}a,a:visited {   color:         #1466b2;}a,a:visited {  

text-decoration: none;}.bbnn {   background:    #f5f5f5;   border-bottom: 1px solid #f9f9f9;   -webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);   box-shadow:    0 3px 3px rgba(0, 0, 0, 0.1);   display:       block;  

height:        34px;   position:      relative;   text-align:    center;   z-index:       10;   }.bbnn-logo {   display:       block;   font-weight:   bold;   margin: 7px 0px 8px;   text-decoration: none;}.bb-logo-img {  

background:    url(img/oracle-logo20.png) no-repeat;   display:       block;   float:         left;   height:        20px;   width:         160px;}.bb-logo-text {   font-size:     12pt;   display:       block;   float:    

left;   color:         #454545;   padding:       6px 0 0 4px;}.sec-container {   display:       block;   position:      relative;   text-align:    center;}.sec {   clear:         both;   display:       inline-block;  

position:      relative;   text-align:    left;   width:         970px;}                Cloud                  Your Oracle Planning Cloud Service environment is currently unavailable. Our team is actively working to

resolve this unplanned downtime and to restore your service(s) as quickly as possible. In the meantime we encourage you to visit cloud.oracle.com     Oracle Applications &mdash; Empowering Modern Business in the Cloud

At E:\App\Oracle\EPM Automate\bin\EPBCS_DATALOAD_GL_REJECTS_ASO.ps1:118 char:21

+ ... tresponse = Invoke-RestMethod -Uri $uri -Method POST -Headers $header ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

So, what is wrong here, any suggestions? Another quote/double-quote typo, or something else? This code is in the ps1 script which is called from within another - working - ps1 script, and lots of it is just a copy of it.

For those not into REST, see part B (separate discussion in the same community board), where I try the same using EPM Automate calls from within PowerShell. With the same "success"

Any help appreciated,

Milos

Comments