Error in parsing JSON Payload - Cannot index into a null array.
Summary:
An error occurred during the API request: {"links":[],"status":4,"details":"EPMFDM-ERROR: Error in parsing JSON Payload"}
Cannot index into a null array.
+ $uri = $restResponse.links[0].href
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Content (required):
I am trying to run the data load rule using REST API functionality.
I am passing arguments for loadrule1, startperiod1, and endperiod1 from the batch file.
Code Snippet (add any code snippets that support your topic, if applicable):
$body= '{ "jobType":"DATARULE", "jobName":"$loadrule1", "startPeriod":"$startPeriod1", "endPeriod":"endPeriod1", "importMode":"REPLACE", "exportMode":"NONE", }' $uri = "$url/aif/rest/V1/jobs" try { $response = Invoke-RestMethod -Uri $uri -Method Post -Body $body -Headers $headers -ContentType "application/json" -ErrorAction Stop Write-Host "API Response Content:" $response.Content } catch { Write-Host "An error occurred during the API request: $_" } $uri = $restResponse.links[0].href
Tagged:
0