Batch Ingestion API upload failure | Community
Skip to main content
Level 2
October 18, 2023
Question

Batch Ingestion API upload failure

  • October 18, 2023
  • 3 replies
  • 1210 views

I am trying to upload small file using batch ingestion api, in the existing data set via json file.

My json file looks good and valid. I am able to upload same file via UI but unable to upload it via API.

Getting the below error:

Input file: sample.json is not valid JSON file. Expecting the first character to be `[` or `{`, but 'm' is found. Please fix and re-ingest.

 

Sample Json content:

[{"_compname":{"Obj":{"key":"123","ID":"001", "con":"IN", "Name":"test"}}}]

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Anil_Umachigi
Adobe Employee
Adobe Employee
October 18, 2023

@hareeshgo Could you add more info? the endpoint you used? 

Were you able to create a batch and followed up with a put request with batch id? 

 

Anil 

arpan-garg
Community Advisor
Community Advisor
October 30, 2023

Hi @hareeshgo - As @anil_umachigi mentioned, it would be good to have more context on this.

Adobe Employee
March 25, 2024

When I had seen a similar error the problem ended up being that I was configuring my PUT request wrong. The language in my case is Python. I was setting the Content-Type header to "application/octet-stream" but I was creating the request like:

 

 

response = requests.put(url=url, headers=HEADERS, files={'file': file})

 

 

but what ended up working was:

 

 

response = requests.put(url=url, headers=HEADERS, data=file.read())

 

 

 

My understanding is that using the `files={'file': file}` parameter instructed Python's `requests` to override the Content-Type header and it actually created a `multipart/form-data` request, causing the endpoint to reject the request. Passing the actual file binary (via `file.read()`) using the `data` parameter kept the content type as "application/octet-stream"