Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

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

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!